What are the global table in SQL Server
Global temporary table is created in the tempdb and it is visible to all the sessions . Global temporary tables are only destroyed when the current user disconnected and all the sessions referring to it closed. It means no user sessions refers it. Since the global temporary table is created in the tempdb, whenever we use temporary tables there is a interaction between the two database (tempdb and the database in which block of code is written) which may slow down the performance. Global temporary table can be used in Joins. Global table is created with the help of the ##.
The syntax for creating the global temporary table is given below:
create table ##[table name] (col1 datatype, col2 datatype, ......coln datatype)
Read More..   [43 clicks]
Published under: SQL Server Interview Questions · · · ·