Generate insert scripts in SQL Server

Generate scripts: Microsoft Learn documentation

Simple Data Scripter source: Github project

It is commonly useful when you want to generate a simple insert script from the resultset that you generated using a table content, a view, or a complex query. There are 2 quick methods:

  1. Log in to the destination db in SSMS.

  2. Right-click on database name in Object Explorer window. Select Generate Scripts… option.



  3. In the wizard click Next



  4. After loading the database objects list pick a selected table name. Click Next

    .


  5. On Scripting Options window choose the destination where your generated script will land. Then, go to Advanced.



  6. In Advanced window, among plenty of options, choose “Type of data to script” as Data only. You can consider also other scripting options if needed.



  7. Hit OK and Next. The generation takes couple of seconds, depending on a number of files and rows to script.
  1. Open Azure Data Studio, navigate to Extensions tab on the left and look for Simple Data Scripter. Install it (it may redirect you to github page).



  2. Once downloaded, install it from external source (the file downloaded in step 1.)

    .


  3. After the installation log in to the database, find your desired table or view to be scripted, right-click on its name and choose Script Table Data. In fact it can be any table in the system – the dialogue box will let us change the script.