Script all data from SQL Server database

前端 未结 3 1145
忘掉有多难
忘掉有多难 2020-12-03 01:35

I have two databases with equivalent structure and I need to extract data from one of them in form of INSERT statements (generate script to apply it on the othe

3条回答
  •  甜味超标
    2020-12-03 02:07

    You can do it with SQL Server Management Studio. Here are the steps - as Mitch Wheat describes above (for SQL Server Management Studio 2012):

    1. Right-click your database.
    2. Select Tasks > Generate Scripts...
    3. Introduction Step. Click Next.
    4. Choose Objects. Select entire database or selected objects. Click Next.
    5. Set Scripting Options. Here's the key step. In order to get all data and objects, click the Advanced button. Then in the Advanced Scripting Options, set the value for Types of data to script to Schema and data.
    6. Click OK. Then Next and Finish.

    You will have a script file that contains both database schema and data.

提交回复
热议问题