Posted By: Anonymous
I thought this would be trivial, but it isn’t… I’m sure there is a simple way to do it but I can’t manage to find it. Shame on me.
I want to import/export the database itself, the tables, the constraints (foreign keys and so on). I’d rather not get the data with it, but I can get rid of it after if there’s no other way.
So… how do you export a database using MS SQL Server Management Studio ? How do you import it?
The only solution I found was right click on the tables and “script to Create”, but I have something like 100 tables, so I’d rather avoid this.
Right click the database itself, Tasks -> Generate Scripts…
Then follow the wizard.
For SSMS2008+, if you want to also export the data, on the “Set Scripting Options” step, select the “Advanced” button and change “Types of data to script” from “Schema Only” to “Data Only” or “Schema and Data”.