跳至主要内容

Generating DB Script with Data in SSMS

· 閱讀時間約 1 分鐘

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:

  1. Right click on the database and choose Tasks -> Generate Scripts

  2. In the wizard, select the object (i.e. table) you need to generate the SQL script

  3. In the Set Scripting Options dialog, Click Advanced.

  4. 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.