Results 1 to 5 of 5

Thread: Bulk insert

  1. #1
    Join Date
    Feb 2004
    Posts
    7

    Unanswered: Bulk insert

    Hi,

    I want to use bulk insert using a text file to import data from it to the DB, but how can I ignore the primary keys in the text file which is in the db table.

    regards,

  2. #2
    Join Date
    Aug 2002
    Location
    Scotland
    Posts
    1,578
    I think there is no direct way to deal with to ignore PK constraint while Bulk inserting. You need to drop them before insert and re-enable once it finishes.
    --Satya SKJ
    Microsoft SQL Server MVP
    [IMG]http://sqlserver-qa.net/google_bart.gif[/IMG]

  3. #3
    Join Date
    Nov 2002
    Location
    Jersey
    Posts
    10,322
    Originally posted by Satya
    I think there is no direct way to deal with to ignore PK constraint while Bulk inserting. You need to drop them before insert and re-enable once it finishes.
    Which will fail if this is an issue for you now...

    Why not load the data to a staging table, and audit the data before dropping it in to the destination table?
    Brett
    8-)

    It's a Great Day for America everybody!

    dbforums Yak CorralRadio 'Rita
    dbForums Member List
    I'm Good Once as I ever was

    The physical order of data in a database has no meaning.

  4. #4
    Join Date
    Feb 2004
    Posts
    7
    I know other solutions but I want this one because the system is a real time system and I want the fastest way which is bulk insert.

    regards,

    Originally posted by Brett Kaiser
    Which will fail if this is an issue for you now...

    Why not load the data to a staging table, and audit the data before dropping it in to the destination table?

  5. #5
    Join Date
    Jul 2003
    Location
    San Antonio, TX
    Posts
    3,662
    If you want to "skip" a field, it's in BOL under "Using a Data File with Fewer Fields"...Wait a minute, I found this in my clipboard...Am I loosing my mind, or it's the same post? Oh, I get it, Groundhog day all over...hehehehe, I know all the answers!!!!!!!!

Posting Permissions

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