Script all data from SQL Server database

不打扰是莪最后的温柔 提交于 2019-11-27 13:32:18
marc_s

You could use the free SSMS Toolpack add-in for SQL Server Management Studio.

See the section on Generate Insert statements from resultsets, tables or database

Update: OK, for SSMS Toolpack in SSMS 2012, a licensing scheme has been introduced. SSMS Toolpack for earlier versions of SSMS are however still free.

SSMS supports scripting all data as INSERTS in 2k8:

Right click on a database and select Tasks->Generate Scripts...

Pick only the tables, Click Next.

Click on the Advanced button. Scroll down and select "Types of data to script" == Data Only

Decide whether you want results in a new query window or a file. Click on to Finish.

You then change the using DBname at the top of the script.

ShakirAhmad

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.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!