Reputation: 25573
Suppose I have a table with data like:
Tab(id, name)
1, 'Name 1'
2, 'Name 2'
3, 'Name 3'
In SQL Server management studio, I can generate script to create this table(ddl). But I also want generate sql for data like:
insert into Tab(id, name) values(1, 'Name 1');
insert into Tab(id, name) values(2, 'Name 2');
insert into Tab(id, name) values(3, 'Name 3');
How to generate above insert sql with data for a table?
Upvotes: 1
Views: 388
Reputation: 4328
Under Tasks > Generate scripts you can hit 'Advanced'
One of the choices is "Types of Data to Script" which is set by default as Schema only.
Go for "Data and Schema" and that's it.
Upvotes: 2
Reputation: 635
This will help: http://sqlblog.com/blogs/eric_johnson/archive/2010/03/08/script-data-in-sql-server-2008.aspx
Upvotes: 0