SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
Register Now and get your question answered!
Save Password
Forgot your Password?

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 remove constraints
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

Starting Member

2 Posts

Posted - 11/30/2012 :  01:03:55  Show Profile  Reply with Quote
hi guys,

I have a table named table1 having columns C1 (PK, int, null) and C2 (datetime, not null).
I want to write a query to copy all these columns into a new table after removing all the constraints.

Can anybody provide a solution to this ? thanks in advance.

Flowing Fount of Yak Knowledge

2234 Posts

Posted - 11/30/2012 :  01:27:10  Show Profile  Reply with Quote

-- To create duplicate table without data from an Original Table
INTO DuplicateTable
FROM table1
WHERE 1=2 -- If you want data also, then remove WHERE condition

SELECT * FROM DuplicateTable -- Table Without Constraints

Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.06 seconds. Powered By: Snitz Forums 2000