Hi
I want to copy the structure & all constrains of one table into other table.
There is any Direct query is there without using Sql Scirpt???
Printable View
Hi
I want to copy the structure & all constrains of one table into other table.
There is any Direct query is there without using Sql Scirpt???
You have a function called as copy function in SQL server which you can use to copy the structure and all constrains of one table into other table. If you want to make a clone of the same table with structure, constraints and data you can make use of clone function available with SQL server.
create table tablename 1 from select * from tablename2
Using INTO we can copy..
SELECT TOP 0 * INTO New_Table_Name From Old_Table_Name
The Above query will come only the structure for the table..
If U want to copy with the data then remove the "Top 0 "..
SELECT * INTO New_Table_Name FROM Old_Table_Name