Link to home
Start Free TrialLog in
Avatar of REA_ANDREW
REA_ANDREWFlag for United Kingdom of Great Britain and Northern Ireland

asked on

BULK INSERT

HI,

I have having a little trouble with this T-SQL procedure.

I need it to auto generate the ID field when I execute the command against my file.  But it keeps coming back with an error about Not for Replication.

Has anyone had experience of this when you have an Identity Column?

Thanks in advance

Andrew
Avatar of Guy Hengel [angelIII / a3]
Guy Hengel [angelIII / a3]
Flag of Luxembourg image

>I have having a little trouble with this T-SQL procedure.
which one?

anyhow:
when loading (external) files to sql tables, I can only recommend 1 thing:
use staging tables to bulk load the data to, validate there, and the copy to the final table.
see also here:
http://www.sqlteam.com/item.asp?ItemID=3207


Avatar of REA_ANDREW

ASKER

I am using this

            BULK INSERT theusedcarsearch.dbo.tbl_Cars
               FROM 'D:\home\Default\theusedcarsearch.com\htdocs\Feeds\UsedCarSql.sql'
               WITH
                 (
                    FIELDTERMINATOR ='¦',
                    ROWTERMINATOR = '\r\n',
                    KEEPIDENTITY
                  )

completes 60,000 rows in 30 seconds, so for speed it is for me BUT, it complains about the ID column when I have the parameter KEEPIDENTITY

inline with

http://msdn2.microsoft.com/en-us/library/ms188365.aspx
ASKER CERTIFIED SOLUTION
Avatar of Guy Hengel [angelIII / a3]
Guy Hengel [angelIII / a3]
Flag of Luxembourg image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial