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.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Anil JhaRank #1,988 · 733 reputationPosted Aug 8, 2017, 5:40 AM EDT
Pankaj Kumar ChoudharyRank #80 · 24.4K reputationPosted Aug 8, 2017, 6:40 AM EDT
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.
Gokhul VarmanRank #1,505 · 1.1K reputationPosted Aug 8, 2017, 6:51 AM EDT
Puneet KankarRank #446 · 5.6K reputationPosted Aug 8, 2017, 5:06 AM EDT