简体   繁体   中英

Copy a table with constraints in SQL server

When I execute the following query I could make a copy of a table without constraints

Select * into B from A

how to copy a table with constraints by SQL query?

Try below Query:

SELECT *
INTO New Table  
FROM old table
WHERE Constraints  

Example:

SELECT *
INTO Employee3  
FROM Employee  
WHERE [EMP Id] > 1  

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM