Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

how to generate insert statement from existing database

Status
Not open for further replies.

damonpin

Technical User
Oct 27, 2002
2
0
0
HK
hi,

I have a sample database which I know how to create the schema. I want to generate a sql script containing insert data statement from this sample database. I want to give the
sql script containing insert statement to client so they could regenerate the sample database. Is there an existing tool or script that can do that?

Thanks a lot for you help
 
Presumably your sample data is a text(flat) file?
So - use bcp !
eg bcp dbtablename in flatfile
This assumes a tab as field delimiter and \n as record delimeter - read up on bcp for changes to these defaualts
HTH ;-) Dickie Bird

Honi soit qui mal y pense
 
Hi,

There are other ways to deal with this if you really need an INSERT statement--although I'd recommend Dickie's approach as the simplest for sure. (Whether you personally mal y pense or not!)

Various utilities exist that will product INSERT statements from a table's data and if you'd like more info on that, you can reply again.

BOL,

John J M Craig
Alpha-G Consulting, LLC
nsjmcraig@netscape.net
 
It sounds like you want to create a copy of your sample database onto the client's machine. Another possibility is to just Dump the sample database (dump database to "path & filename"), then reload it on the client. If you have the same operating system as the client, that is the easiest and most reliable. Everything will go--permissions, size, data, user datatypes, rules, defaults, etc. If you can do this, this is the way to go.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top