Results 1 to 5 of 5
  1. #1
    Join Date
    Mar 2008
    Posts
    12

    Unanswered: Question On Insert Statment

    Hello,
    I have a table (SQL Server 2000) which contains data and I want to create insert statements based on this data. The reason for this is to create a .sql file to run this against another database to insert the same data. I know I can do an import but was trying to do this via a .sql script. Is there any way to generate these insert statement automatically using some SQL tool?
    Thanks

  2. #2
    Join Date
    Jul 2003
    Location
    San Antonio, TX
    Posts
    3,662
    More efficient way would be to BCP data out, and then use BULK INSERT from within your script on the target instance/database.
    "The data in a record depends on the Key to the record, the Whole Key, and
    nothing but the Key, so help me Codd."

  3. #3
    Join Date
    Sep 2005
    Posts
    161
    rdjaborov is right about using bulk insert. But if you must script the data as sql statements, here is one option:

    HTML Code:
    http://vyaskn.tripod.com/code.htm#inserts

  4. #4
    Join Date
    Feb 2004
    Location
    One Flump in One Place
    Posts
    14,912
    Another option is using http://www.ssmstoolspack.com/. I used it earlier today and it scripted out ~200k fairly narrow rows in about a 3 seconds or so. It is in Beta though so is a bit buggy overall.
    Testimonial:
    pootle flump
    ur codings are working excelent.

  5. #5
    Join Date
    Mar 2008
    Posts
    12
    Thanks to all. I ended up using SQL Compare from Redgate which did the trick for me. Thanks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •