Copy database tables with constraints

I am trying to create a copy of a database in sql server 2016 from  database from sql server 2014 with import/export wizard.
The problem is it does not copy the constraints of the table.
i have tried Enable IDENTITY insert.

Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

HuaMin ChenProblem resolverCommented:
If you're already exported the whole database/schema, you should be able to get also the constraints.

Did you try to export the schema instead?
RIASAuthor Commented:
Thanks,where is the export the schema
Deepak ChauhanSQL Server DBACommented:
I am trying to create a copy of a database in sql server 2016 from  database

Option 1 - If you want to copy all tables and data from SQL server 2014 to 2016, then backup and restore is best option.
1. Take the backup of SQL 2014 database
2. restore the backup file into 2016 database.

Option 2- f you are copying few tables then you can generate schema only script and execute this script into sql 2016 database.
1. Right click on database > task . generate script > next > click on Advance button > here you have multiple option to generate script for Data only , for Schema only , for Both data and schema... this is up to you.

Generate Script
Option 3. Generate script only using above steps , create tables and other objects into sql 2016 database and export data using Import \Export wizard.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Your Guide to Achieving IT Business Success

The IT Service Excellence Tool Kit has best practices to keep your clients happy and business booming. Inside, you’ll find everything you need to increase client satisfaction and retention, become more competitive, and increase your overall success.

HuaMin ChenProblem resolverCommented:
Here is the way to do Backup, from existing schema
Afterwards, you can choose restore like
to further choose your Backup file created, to retrieve the whole schema, within another machine.
Vitor MontalvãoMSSQL Senior EngineerCommented:
I would recommend going for Deepak's option 3.
Option 2 isn't bad for small tables. For large tables it will take longer so go for option 3.
RIASAuthor Commented:
Thanks Experts! Thanks Vitor !
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.