views:

55

answers:

2

Greetings,

How to create duplicate table (structure only) with new name in the same database in SQL Server 2008?

I have table with 45 fields so I want to create new with same structure but new name.

I do not want to copy the data!!

Thank you,

+4  A: 

Right click on the table in SQL Management Studio.

Select Script... Create to... New Query Window.

This will generate a script to recreate the table in a new query window.

Change the name of the table in the script to whatever you want the new table to be named.

Execute the script.

Avalanchis
+6  A: 
SELECT * 
INTO target
FROM  source
WHERE 1 = 2
Conrad Frix
This will only capture some of the structure. Same column names, data types, and nullable settings. But everything else will be left behind. Off the top of my head stuff left behind will include PK, UK, FK and Check constraints, identity attributes and computed columns. It depends on how much of the structure OP wants whether this will meet OP's needs.
Shannon Severance