Anybody know how to copy the table with constraints (including primary key, foreign key, index, etc..) ???
I used the following copy statement and it does copy ONLY the table with records.
If you want to script out the constraints using T-SQL only, I'm doing a blog series on metadata at the moment.
Your other option is to use Powershell / C# / VB.NET and SMO.
None of them are particularly straightforward.
answered May 07, 2010 at 11:37 AM
Matt Whitfield ♦♦
There are two types of command in T-SQL, DDL and DML.
DDL - Data Definition Language is the description of the objects in a database - Tables, Schemas, Procedures and Functions etc
In order to get the new table identical you will need to use a DDL script that creates the table and then use
answered May 07, 2010 at 11:41 AM