Generating DB Script with Data in SSMS
· One min read
SSMS comes with a very handy function which is to generate SQL script for the database. Not just the schema but also the data.
To do that, you will need do this:
-
Right click on the database and choose Tasks -> Generate Scripts
-
In the wizard, select the object (i.e. table) you need to generate the SQL script
-
In the Set Scripting Options dialog, Click Advanced.
-
Select the Type of Data to Script to include Schema and Data or Data Only.
That's it and it will generate the script you need for many tasks, like data migrations.