how I would copy a table with all constraints?

I run select * into myNewTable from baseTable where 1=0

This copy a table but no with constraints


You have to use the GUI management tool to create a script and then run that - you cannot do it directly - take a look here (or here) for relatively clear explanations.

create table myNewTable like baseTable;
  • 4
    I guarantee that's wrong in SQL Server Apr 10 '17 at 9:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.