Alan.B (7/9/2013)
HanShi mentioned local and global temp tables. You don't see this as often but a global temp table has two numbers signs in front of it like so: ##temptable.To get some understanding about the difference between the two, open a new query window in SSMS and run these SELECT statements:
CREATE TABLE #LocalTempTable(xId int);--(1) Local Temp Table
CREATE TABLE ##GlobalTempTable(xId int);--(2) Global Temp Table
INSERT INTO #LocalTempTableVALUES(1);
INSERT INTO ##GlobalTempTableVALUES(1);
Then, in the same query window, you could successfully run these queries:
SELECT * FROM ##GlobalTempTable
SELECT * FROM #LocalTempTable
If you open a new query window, however, and run the two SELECT statements above, the first will be successful but the second one will fail.
Much appreciated, very good example
___________________________________
Computer Enterprise Masoud Keshavarz
I don't care about hell.
If I go there I've played enough Diablo to know how to fight my way out.