How do I create a duplicate table with only the structure duplicated with a new name in SQL server 2008?
I have table with 45 fields so I want to create new with same structure but new name.
If you want to copy the data of one SQL table into another SQL table in the same SQL server, then it is possible by using the SELECT INTO statement in SQL. The SELECT INTO statement in Structured Query Language copies the content from one existing table into the new table.
You can also use the SQL CREATE TABLE AS statement to create a table from an existing table by copying the existing table's columns. It is important to note that when creating a table in this way, the new table will be populated with the records from the existing table (based on the SELECT Statement).
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.
SELECT *
INTO target
FROM source
WHERE 1 = 2
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With