How to generate an insert script that includes all stored rows in sql server

Here are the steps of generating scripts in sql server.

Step 1: Open sql server.
Step 2: Click on database and choose database.

Step 3: Right click on your database which you have selected then there is an option called Task after clicking that you find another option called Generate Scripts.


Step 4: Click on Generate Script, you will get another screen where you can customize option according to you.

In my scenario, I have only two tables in my database and I want to generate table1 script. So I am selecting second option and click next.


Step 5: After clicking next you will get another screen.


Step 6: Click on Advanced button, you will get another screen. Scrolls that screen you will get a property name with “Type of data to script”. By default it is schema only. You can change according to your requirement.

In my case I am going to set “Data only” and say OK.


Step 7: Click Next


Step 8: Click Next


I hope you enjoy this article.

Happy coding 🙂

Tags: ,