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

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.

2

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.

3

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

4

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.

5

Step 7: Click Next

6

Step 8: Click Next

7

I hope you enjoy this article.

Happy coding 🙂

Tags: ,