Temp table in sql server
what is differnt between #temp, ##temp and @temp in sql server , where temp is table name in sql server?
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Gokhul VarmanPosted Aug 8, 2017, 10:51 AM
Pankaj Kumar ChoudharyPosted Aug 8, 2017, 10:40 AM
Global temporary tables are temporary tables that are available to all sessions and all users. Once this table has been created by a connection, like a permanent table then it is available to any user by any connection. They are dropped automatically when the last session using the temporary table has completed. Names of global temp tables start with (“##”) double hash sign.
Temp Variables are also used for holding the data fora temporary time just like Temp tables. Temp variables are created using “DECLARE” statements and are assigned values by using either a SET or SELECT command. After declaration, all variables are initialized as NULL, unless a value is provided as part of the declaration. This acts like a variable and exists for a particular batch of query executions. It gets dropped once it comes out of batch. Temp variables are also created in the Tempdb database but not the memory.
Anil JhaPosted Aug 8, 2017, 9:40 AM
Puneet KankarPosted Aug 8, 2017, 9:06 AM