Monday, March 26, 2012

Export data into a script as "insert into"s

Hello,

I am using a Web based front end to a SQL Server db installed at my host that only lets me import data into tables either manually (in a 'datasheet' view) or with a SQL query.

Does anybody know if I can export data from my local db as a script such as

insert into TestTable(Id, Name) values ("1", "Test1")
insert into TestTable(Id, Name) values ("2", "Test2")
.
.
.

... so that I can run this script on the Web front end and insert data into the db at my host?

Many thanks in advance.Here's a link to some stored procedures you might find useful. I think the DataAs InsCommand may be what you are looking for.

http://www.mssqlcity.com/Scripts/scrImpExp.htm|||Thanks for your help Fred.

That stored procedure mostly does the job but looks like it needs a few slight mods because some data types aren't implemented (such as text which is written out as 'None Yet')...

No comments:

Post a Comment