BULK INSERT lcs.imp_oper from 'd:\data\oper.txt'
WITH (CODEPAGE = 'RAW', FIELDTERMINATOR = '\t', FIRSTROW = 2, FORMATFILE
= 'd:\data\oper.fmt')
oper.fmt:
8.0
2
1 SQLCHAR 0 20 "\t" 1 czak SQL_Czech_CP1250_CI_AS
2 SQLCHAR 0 4 "\n\r" 2 porc SQL_Czech_CP1250_CI_AS
Ripper napsal(a):
> I am attempting to import a CSV file using the Bulk Insert sql command...
>
> USE datasheets
> BULK INSERT tblgrades
> FROM '\\PHS-CI-TEST\c$\book1tab.txt'
> WITH ( FIELDTERMINATOR = '\t', ROWTERMINATOR = '\n\r')
> GO
>
> The command goes, but then I hit an error.
> Msg 4864, Level 16, State 1, Line 1
> Bulk insert data conversion error (type mismatch) for row 1, column 2 (LocID).
>
> The first column is the primary key. the second column, the first one in my
> csv file, is a 6 digit number. On the table it is set to int. I can't
> figure out why I am getting the error when the CSV is a number and the second
> column, the first after the primary key, is set to int.
>
> Anyone have any ideas?
>
>
>> Stay informed about: Import CSV File