How to insert table structure in #temptable

Posted by Karthik2010_Mca under Sql Server on 2/24/2013 | Points: 10 | Views : 754 | Status : [Member] | Replies : 1
Hi,

I have insert user table data in #temptable.
But I want to insert user table structure in #temptable,

Thanks
Karthik.K

Karthik


Responses

Posted by: Pandians on: 2/24/2013 [Member] [MVP] Silver | Points: 25

Up
0
Down
If you want to COPY a table structure to Temp Table...!

SELECT * INTO #Table1 from Table1 WHERE 1=0

GO
Check out the table structure

USE tempdb
GO
sp_help #Table1
GO
But,.....

You will have table structure along with IDENTITY. But, Not Constraints and Index!

Cheers
www.SQLServerbuddy.blogspot.com
iLink Multitech Solutions

Karthik2010_Mca, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response