Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
moonia.das
Starting Member
2 Posts |
Posted - 2010-02-16 : 11:33:47
|
| Hi AllI came across the following line in a procedure:Select ........... from ........ where some_field_name = '##tblname'Plz neglect the ..... part.What I want to ask is what is ## before tblname ?Thanks |
|
|
vijayisonly
Master Smack Fu Yak Hacker
1836 Posts |
Posted - 2010-02-16 : 11:42:11
|
| ##tablename is a gloabl temporary table.Search sqlteam for temporary tables, you will get more info. |
 |
|
|
Kristen
Test
22859 Posts |
Posted - 2010-02-16 : 11:53:05
|
| If it has single quotes around it, as you ahve shown it:some_field_name = '##tblname'then it is just a text string - no magic! |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2010-02-16 : 12:00:47
|
| it seems like a global temporary table name whose name is stored as a value in some other table field i believe.------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
 |
|
|
naveengopinathasari
Yak Posting Veteran
60 Posts |
Posted - 2010-02-16 : 13:27:14
|
quote: Originally posted by vijayisonly ##tablename is a gloabl temporary table.Search sqlteam for temporary tables, you will get more info.
A Table name with ##MyTableName is a Global Temporary Table that means the life of the Temporary table is till the Life of the session opened.#MyTableName is a Local Temporary Table where the life of the table is till the SP/Function is execute after the SP/Function is over the #myTable will not be available.Let me know if any clarification required.Naveen GopinathLets unLearn |
 |
|
|
Kristen
Test
22859 Posts |
Posted - 2010-02-16 : 13:45:53
|
| " the life of the [global] Temporary table is till the Life of the session opened"Not quite: ##TEMP tables lives until the last connection accessing it is closed, and thus not limited to the session that created / opened it. |
 |
|
|
|
|
|