Creating Global Table in T-Sql,and its advantage............
Declare @sql Varchar(Max)
set @sql ='Select * into #tempemp from table tblEmployee'
exec(@sql)
It will gives you an error, so here you can create a Global table,which is also a temporary table but have a global access...
Declare @sql Varchar(Max)
set @sql ='Select * into ##tempemp from table tblEmployee'
exec(@sql)
Now this sql statement will execute easily..
In the above example ##tempemp is used as a gloabal table.
Hope this intresting thing will help to all developers...........
Hi,Here I am submitting an intresting topic related to global table, As every sql developer known red query. But the major problem is that ,in red query you can not create temporary table.But with use of global table you can create a temporary table with in in red query.
Example:Declare @sql Varchar(Max)
set @sql ='Select * into #tempemp from table tblEmployee'
exec(@sql)
It will gives you an error, so here you can create a Global table,which is also a temporary table but have a global access...
Declare @sql Varchar(Max)
set @sql ='Select * into ##tempemp from table tblEmployee'
exec(@sql)
Now this sql statement will execute easily..
In the above example ##tempemp is used as a gloabal table.
Hope this intresting thing will help to all developers...........
cheers
Puneet Kumar
No comments:
Post a Comment