Is there any way to export
a Microsoft SQL Server database to an sql
script?
I'm looking for something which behaves
similarly to mysqldump, taking a database name, and producing a single script which will
recreate all the tables, stored procedures, reinsert all the data
etc.
I've seen href="http://vyaskn.tripod.com/code.htm#inserts"
rel="noreferrer">http://vyaskn.tripod.com/code.htm#inserts, but I ideally
want something to recreate everything (not just the data) which works in a single step
to produce the final script.
In SQL
Server Management Studio right-click your database and select Tasks / Generate Scripts.
Follow the wizard and you'll get a script that recreates the data structure in the
correct order according to foreign keys. On the wizard step titled "Set Scripting
Options" choose "Advanced" and modify the "Types of data to script" option to "Schema
and data"
TIP: In the final step select "Script
to a New Query Window", it'll work much faster that way.
Comments
Post a Comment