Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 remove constraints

Author  Topic 

rishabhgairola
Starting Member

2 Posts

Posted - 2012-11-30 : 01:03:55
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.

bandi
Master Smack Fu Yak Hacker

2242 Posts

Posted - 2012-11-30 : 01:27:10
Hi,


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


SELECT * FROM DuplicateTable -- Table Without Constraints


--
Chandu
Go to Top of Page
   

- Advertisement -