-- CHECK AND DROP TEMP TABLE IF EXISTS
IF OBJECT_ID ('Tempdb.dbo.#TestTempTable') IS NOT NULL
BEGIN
DROP TABLE #TestTempTable
END
-- CREATE TEMP TABLE
CREATE TABLE #TestTempTable (
RowID tinyint not null,
City varchar(50) not null
)
-- POPULATE WITH DATA
INSERT INTO #TestTempTable
SELECT 1,'London'
UNION
SELECT 2, 'Chicago'
UNION
SELECT 3, 'Paris'
/***
MORE CODE HERE
***/
SELECT * FROM #TestTempTable
-- WHEN DONE CLEAN UP THE TEMP TABLE
DROP TABLE #TestTempTable
No comments:
Post a Comment