IF OBJECT_ID('tempdb..#tempEmployee')
IS NOT NULL DROP TABLE #tempEmployee
-- Create temp table #tempEmployee
CREATE TABLE #tempEmployee
(
ID
INTEGER NOT
NULL,
EmpName
VARCHAR(50) NOT NULL
);
INSERT INTO #tempEmployee(ID, EmpName)
SELECT 1, 'AAA'
UNION
SELECT 2, 'BBB'
SELECT * FROM #tempEmployee -- Get two records
DROP TABLE #tempEmployee
SELECT * FROM #tempEmployee -- Error : Invalid object name '#tempEmployee'
Please leave your comments if it is useful for you.
No comments:
Post a Comment