Tuesday, 29 December 2009

SQL server indexed temp table

IF (SELECT object_id('TempDB..#TempTable')) IS NOT NULL
DROP TABLE #TempTable
GO
--
CREATE TABLE #TempTable
(
id int,
name varchar(50),
primary key (id, name)
)
--
INSERT INTO #TempTable
SELECT 1,'name'
--
SELECT * FROM #TempTable

No comments:

Post a Comment