Friday, January 2, 2009

Use Temporary Tables in MSSQL

Create
CREATE TABLE #TempTable(FieldName1 VarChar(50), DateField1 DateTime, FieldName2 Int)
Inserting into the temp table is executed like any other table:
INSERT INTO #TempTable () VALUES ()
The table is dropped when the session is dropped. Otherwise:
DROP TABLE #TempTable

No comments: