Duplicate a SQL Server table
-
Here's what I want to do: I have an application that delivers web based security forms for individuals to fill out. I am trying to write a GUI that will allow someone with little coding experience create a form. I want to offer the option of copying an existing form (including the actual ASP page and SQL table). I can handle duplicating and renaming the actual ASP form, but I can find no information on how to copy a tables columns, data types, constraints and triggers from an existing table to a new one, renaming the new table to correlate to the new form. I hope someone can help me. Thanks!
-
Here's what I want to do: I have an application that delivers web based security forms for individuals to fill out. I am trying to write a GUI that will allow someone with little coding experience create a form. I want to offer the option of copying an existing form (including the actual ASP page and SQL table). I can handle duplicating and renaming the actual ASP form, but I can find no information on how to copy a tables columns, data types, constraints and triggers from an existing table to a new one, renaming the new table to correlate to the new form. I hope someone can help me. Thanks!
Probaly the most straight forward method would be to create a DTS package, then call that from code - can supply an example if necessary, but not to bad to just "have a go at"... "Now I guess I'll sit back and watch people misinterpret what I just said......" Christian Graus At The Soapbox
-
Probaly the most straight forward method would be to create a DTS package, then call that from code - can supply an example if necessary, but not to bad to just "have a go at"... "Now I guess I'll sit back and watch people misinterpret what I just said......" Christian Graus At The Soapbox
I would agree with Richard in using the DTS package if the requirement are to copy the triggers, indices & constraints as well. For a just a table the easiest way would be to
Select *
Into [tblNewTable]
From [tblExistingTable]
Where 0=1Michael I firmly believe that any man's finest hour, the greatest fulfillment of all that he holds dear, is that moment when he has worked his heart out in a good cause and lies exhausted on the field of battle - victorious. Vince Lombardi (1913-1970)