user2053594
user2053594

Reputation: 3

Script database with data

While I am generating script of a database, only the tables and stored procedures are scripted. But I also want the data also. I am using SQL Server 2008. Is there any provision to script with data in a single file?

Upvotes: 0

Views: 259

Answers (3)

neelsg
neelsg

Reputation: 4842

You can always write your own if it is not too much effort. You can even automate some of it using excel etc. To do this, try:

SELECT 'INSERT INTO sometable (field1, field2, field3)
 VALUES (''' + field1 + ''', ''' + field2 + ''', ''' + field3 + ''');'
 AS insrow FROM sometable

Upvotes: 0

Sobhan
Sobhan

Reputation: 816

set the script data option to true in the "Choose Script option wizard"

You can also refer to

http://blog.sqlauthority.com/2009/07/29/sql-server-2008-copy-database-with-data-generate-t-sql-for-inserting-data-from-one-table-to-another-table/

Upvotes: 1

SQLGuru
SQLGuru

Reputation: 1099

APEXSQL have a tool that will allow you to script your entire DB with data...

Upvotes: 0

Related Questions