Dear all,
I could use some help with the script below that I am using to import a HUGE .CSV file into SQL Server 2005.
Here is the code that I am running:
CREATE TABLE AnalysisFile
(BillingDate TEXT,
Soldto INT,
PickupFrom VARCHAR(40),
PostalCode VARCHAR(40),
Matnr INT,
Weight INT,
Desloc INT,
Shippoint INT,
Markup INT,
Pieces INT)
GO
BULK INSERT AnalysisFile
FROM 'h:\product management\extracted files\200812.csv'
WITH
( FIRSTROW = 2,
MAXERRORS = 0,
FIELDTERMINATOR = ',',
ROWTERMINATOR = '\t\n'
)
GO
When I run this code I get these errors:
Msg 4866, Level 16, State 8, Line 2
The bulk load failed. The column is too long in the data file for row 1, column 10. Verify that the field terminator and row terminator are specified correctly.
Msg 7301, Level 16, State 2, Line 2
Cannot obtain the required interface ("IID_IColumnsInfo") from OLE DB provider "BULK" for linked server "(null)".
I have tried running this with several variations Like:
FIELDTERMINATOR = ',',
ROWTERMINATOR = '\n'
or
FIELDTERMINATOR = '\t',
ROWTERMINATOR = '\n'
or
FIELDTERMINATOR = '","',
ROWTERMINATOR = '\n'
But none of these work.
One thing to note is the import works fine if I delete the header row (1st row of records from the CSV file; however the file has to be split to open it and accomplish this). In doing so I would have to work with over 1,200 individual files - because excel and notepad max out on the size...
I could use some help with the script below that I am using to import a HUGE .CSV file into SQL Server 2005.
Here is the code that I am running:
CREATE TABLE AnalysisFile
(BillingDate TEXT,
Soldto INT,
PickupFrom VARCHAR(40),
PostalCode VARCHAR(40),
Matnr INT,
Weight INT,
Desloc INT,
Shippoint INT,
Markup INT,
Pieces INT)
GO
BULK INSERT AnalysisFile
FROM 'h:\product management\extracted files\200812.csv'
WITH
( FIRSTROW = 2,
MAXERRORS = 0,
FIELDTERMINATOR = ',',
ROWTERMINATOR = '\t\n'
)
GO
When I run this code I get these errors:
Msg 4866, Level 16, State 8, Line 2
The bulk load failed. The column is too long in the data file for row 1, column 10. Verify that the field terminator and row terminator are specified correctly.
Msg 7301, Level 16, State 2, Line 2
Cannot obtain the required interface ("IID_IColumnsInfo") from OLE DB provider "BULK" for linked server "(null)".
I have tried running this with several variations Like:
FIELDTERMINATOR = ',',
ROWTERMINATOR = '\n'
or
FIELDTERMINATOR = '\t',
ROWTERMINATOR = '\n'
or
FIELDTERMINATOR = '","',
ROWTERMINATOR = '\n'
But none of these work.
One thing to note is the import works fine if I delete the header row (1st row of records from the CSV file; however the file has to be split to open it and accomplish this). In doing so I would have to work with over 1,200 individual files - because excel and notepad max out on the size...