1

I have to port sql server (2008) database with t-sql scripts. I can generate "create" script per each database object (stored procedure, table) from Sql Server Management Studio (though it looks to take much time)

How do I port data for tables? I'd like to have scripts like that:

INSERT INTO ... VALUES(...)
INSERT INTO ... VALUES(...)
INSERT INTO ... VALUES(...)
...

Can I generate such scripts from Sql Server Management Studio or is there some free 3'rd party utility for that? (I guess there should be).

Thank you in advance!

Andrew Florko
  • 7,672
  • 10
  • 60
  • 107
  • 1
    possible duplicate of [Get script of SQL Server data](http://stackoverflow.com/questions/2321052/get-script-of-sql-server-data) – codingbadger Jun 15 '11 at 10:25

2 Answers2

2

The (free) SMSS Tool pack addin can generate insert scripts for a DB.

Alex K.
  • 171,639
  • 30
  • 264
  • 288
1

If you're going to be doing bulk inserts of data, I'd suggest using bulk insert. You can do the insert from T-SQL, but I prefer to use the bcp command line utility as I can do both the export and import with minimal change to the run line. Oh... and it runs a lot faster than a bunch of insert statements. Have a look at the documentation and see if it fits your purposes.

Ben Thul
  • 31,080
  • 4
  • 45
  • 68