Import export tables

RIAS
RIAS used Ask the Experts™
on
Hello,
When i import tables from one database to other by import export wizard, the constraints are not copied.
I am using sql server 2014 .

Cheers
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Vitor MontalvãoIT Engineer
Distinguished Expert 2017

Commented:
That wizard is only to transfer data. If you want the table schema you'll need to use the Script Objects feature.

Author

Commented:
Vitor,
Can you point to steps please.
IT Engineer
Distinguished Expert 2017
Commented:
Right-click on the database name and select "Tasks" / "Generate Scripts...":
GenerateScripts.PNGThen, when setting the Options, click on "Advanced" and this will pop-up a new window where you can set to script "Schema and data" (be careful that this might generate a very big file if you're dealing with large tables). You can also see that it will script the Constraints by default:
Generate-Scripts---Schema-and-Data.PNG

Author

Commented:
As always Spot On!

Author

Commented:
Cheers!

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial