SQL Server Temp Table vs Table Variable

The administrators of our customer database requested that we not use temporary tables in our stored reporting procedures ( #Table), but instead use variable tables.

Are variable tables less efficient than temporary tables?

In addition, if I create a table as #Table, unlike ##table, then with one there #will be a session table, unlike ##, which is global, right? When stored procedurecompleted, and you are not fulfilling DROP TABLE #table... yet #Table? If it is session based, then will I have access to it again?

+4
source share
3 answers

, (. KB # 243586 KB # 305977), - - .

##table . yes #table , .

CTE (Common Table Expressions), - . : , CTE ?

+2

100%, , , , ... :

DECLARE @Banana TABLE 
(
  Id INT,
  Name VARCHAR(20)
)
0

SP (#table), SP. BOL :

, ,   DROP TABLE:

  • , , , . , , . , .

  • .

  • , . Transact-SQL. , Transact-SQL, .

-1
source

All Articles