SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
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  

rishabhgairola
Starting Member

India
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.

bandi
Flowing Fount of Yak Knowledge

India
2210 Posts

Posted - 11/30/2012 :  01:27:10  Show Profile  Reply with Quote
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
  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.05 seconds. Powered By: Snitz Forums 2000