Get System Generated Object_Id for Table Variable


  
 
 DECLARE @ColMapTable TABLE (ColumnName varchar(300),ColumnDataType varchar(300),Lengths varchar(10))
declare @tempid int


select top 1 @tempid=id  from tempdb..sysobjects
  where type ='U'
  order by crdate desc

  select top 1  id as object_id  from tempdb..sysobjects
  where type ='U'
  order by crdate desc

 

 ---the table variable is stored as Temporary Tables in tempdb
  select top 1 name  from tempdb..sysobjects
  where type ='U'
  order by crdate desc


 
Advertisements


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s