Created
January 10, 2011 16:58
-
-
Save phpleo/773046 to your computer and use it in GitHub Desktop.
tsql: Creando una tabla temporal y llenandola con registros de una tabla existente
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Crear tabla temporal con los valores actuales del campo EnEjecucion | |
-- eliminando si existe | |
IF OBJECT_ID( N'tempdb..#ProyectoEnejecucionEstado') IS NOT NULL | |
DROP TABLE #ProyectoEnejecucionEstado; | |
GO | |
-- creando la tabla temporal | |
CREATE TABLE #ProyectoEnejecucionEstado ( | |
CodigoProyecto CHAR(6), | |
EnEjecucion BIT | |
); | |
GO | |
-- insertando los datos actuales de la tabla proyecto | |
INSERT INTO #ProyectoEnejecucionEstado(CodigoProyecto, EnEjecucion) | |
SELECT p.CodigoProyecto, p.EnEjecucion | |
FROM Proyecto.Proyecto p; | |
GO | |
-- comprobando | |
SELECT * FROM #ProyectoEnejecucionEstado | |
GO |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment