bulk insert !!!

  •  

       I've one table and it has only one column (phone_number). I need to bulk insert from the file. The bulk insert is happening, but i need to check from the file when it is being inserted into the database whether the particular column values in the database should not be the same while you inserting.

        When the bulk insert is happening then i need to check that only those number to inserted which is not already in the database. Could anyone help me out please in this regard. Is there any query for that for checking the database query bulk insert.

     

    in advace thanks...

  • Two ideas come to mind:

    1) BULK INSERT into a temporary table and then use an INSERT with OUTER JOIN to load the actual table.

    2) Set the BATCHSIZE = 1 and the MAXERRORS to some very large number. I've not tried to last myself, and given you've dropped the transaction commit down to row by row there's going to be a performance hit, so I'd lean towards #1.

     

     

    K. Brian Kelley
    @kbriankelley

  • Definitely #1.


    My blog: SQL Soldier[/url]
    SQL Server Best Practices:
    SQL Server Best Practices
    Twitter: @SQLSoldier
    My book: Pro SQL Server 2008 Mirroring[/url]
    Microsoft Certified Master: SQL Server, Data Platform MVP
    Database Engineer at BlueMountain Capital Management[/url]

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply