Here's my procedure (see below), when I run I get this error:
"Bulk Insert data conversion error (type mismatch) for row 1, col 1"
How do I have BULK INSERT load my first column (defined as Identity, Seed=1, Increment=1)... this is my first problem.
The first column of my source text file needs to go into 2nd col of my table. 1st col of my table is for a unique key (Identity).
(added KEEPIDENTITY and it didn't seem to make a difference).
Am totally new to SQL Server, please help, thanks.
--------------------------
CREATE PROCEDURE test AS
TRUNCATE TABLE mytable
EXEC sp_dboption "mydatabase", "select into/bulkcopy", TRUE
BULK INSERT mydatabase.owner.[mytable]
FROM 'C:\abc.txt'
WITH (
DATAFILETYPE = 'char',
FIELDTERMINATOR = '","',
TABLOCK
)
GO