Call now: (800) 766-1884  



 Home


 SQL Server Tips
 SQL Server Training

 SQL Server Consulting
 SQL Server Support
 SQL Server Remote DBA



 Articles
 Services
 SQL Server Scripts
 Scripts Menu



 

 

 

   
  SQL Server Tips by Gama and Naughter

 

Global temporary tables

 

A global temporary table's name starts with ##, it is visible to all users and the server will delete it only after all users that referenced it close their connections. It is also stored in table sysobjects from database tempdb but its name has no extra characters.

 

Table variables

 

A table variable has the most limited scope of all temporary tables; it will be created, exist and be accessible only within a function, stored procedure, or batch where it was declared. It also cannot use the INSERT INTO {table variable} EXEC {stored procedure} and SELECT {fields} INTO {table variable}. Despite that, it has great advantages such as resulting in fewer recompilations of the stored procedures than using local or global temporary tables and require less locking and logging resources from the server. This table is stored in table sysobjects from database tempdb with a name like #33D4B598 or any other hexadecimal value created by the system.

 

There are a few examples with temporary tables in the Cursors section.
 


The above book excerpt is from:

Super SQL Server Systems
Turbocharge Database Performance with C++ External Procedures

ISBN: 0-9761573-2-2
Joseph Gama, P. J. Naughter

 http://www.rampant-books.com/book_2005_2_sql_server_external_procedures.htm
 

 

Burleson Consulting Remote DB Administration


 

 


 

 

 

 

 
Burleson is the America's Team

Note: The pages on this site were created as a support and training reference for use by our staff of DBA consultants.  If you find it confusing, please exit this page.

Errata?  SQL Server technology is changing and we strive to update our SQL Server support information.  If you find an error or have a suggestion for improving our content, we would appreciate your feedback.  Just  e-mail:and include the URL for the page.
 


Burleson Consulting
SQL Server database support

 

Copyright 1996 -  2013 by Vaaltech Web Services. All rights reserved.

Hit Counter