[thelist] SQL Server Export As Query?

Joshua Olson joshua at waetech.com
Wed Aug 4 10:20:13 CDT 2004

> -----Original Message-----
> From: Rob Smith
> Sent: Wednesday, August 04, 2004 10:55 AM

> Does anyone know how to export a table in SQL Server 2k as a insert query?


I don't know off-hand of a simple answer, but if you know the way the
results are supposed to look, you could roll your own fairly easily.  MS SQL
Server has stored procedures that allow you to programmatically determine
field names, field types etc.  So, it would be fairly straight-forward to
build code that extracts the table structure information, pulls all the data
down, then builds a series of inserts.

SQL Server does have a utility to push the data out to a flat-file in a
couple easy steps.  Also, you can fairly easily generate the scripts for the
table structure itself.  These two together should be enough to move all the
data to another database if necessary.

Joshua Olson
Web Application Engineer
WAE Tech Inc.

More information about the thelist mailing list