Generate Script Having Data as Well Using SSMS in SQL Server

Here is the procedure for generating scripts in SQL Server.

Step 1

Open SQL Server.

Step 2

Click on database and choose database.

pramodTest

Step 3

Right-click on the database you selected. There will be an option called Task; after clicking it you will see another option called Generate Scripts.

generate script

Step 4

Click on Generate Script, you will get another screen where you can customize the options depending on you.

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

select table

Step 5

After clicking next you will get the following screen:

set script option

Step 6

Click the Advanced button, you will get another screen. Scroll down that screen and you will get a property named “Type of data to script”. By default it is schema only. You can change it depending on your requirements.

In my case I will set “Data only” and say OK.

Data only

Step 7

Click Next.



Step 8

Click Next.

save or publish

Step 9

Click Finish.

I hope you enjoy this article.

Happy coding.


Similar Articles