November 27, 2008 at 4:39 am
Hi got a little problem i am trying to bulk load log files which all have the same format.
This is what a row of the log looks like,
"213.255.218.250.ng","26/Oct/2008:15:12:11 +0000","GET","/mobile/i/index.shtml","HTTP/1.0","200","6340","-","Nokia6300/2.0 (05.50) Profile/MIDP-2.0 Configuration/CLDC-1.1","*490488cb0ae700949d1700144f81ca5f:-","www.bbc.co.uk"
The " " indicate each column and the ',' represents the end of each column.
Using the following query in sql server 2005 express,
BULK
INSERT dbo.tbl_test
FROM 'D:\MAD\Logs\www_logs\www.20081026.mob.log'
WITH
(
FIELDTERMINATOR = ',',
ROWTERMINATOR = ''
)
GO
The table has the following columns,
Host varchar(50)Checked
requeststampvarchar(50)Checked
fetchtypevarchar(20)Checked
url varchar(300)Checked
httpver varchar(15)Checked
statuscodevarchar(50)Checked
bytes varchar(15)Checked
bytes2 varchar(15)Checked
useragentvarchar(500)Checked
cookie varchar(60)Checked
domain varchar(10)Checked
But when i try to run the query i am getting the following error,
Msg 4863, Level 16, State 1, Line 1
Bulk load data conversion error (truncation) for row 1, column 11 (domain).
Msg 4863, Level 16, State 1, Line 1
Bulk load data conversion error (truncation) for row 2, column 11 (domain).
Msg 4863, Level 16, State 1, Line 1
Bulk load data conversion error (truncation) for row 3, column 11 (domain).
Msg 4863, Level 16, State 1, Line 1
Bulk load data conversion error (truncation) for row 4, column 11 (domain).
Msg 4863, Level 16, State 1, Line 1
Bulk load data conversion error (truncation) for row 5, column 11 (domain).
Msg 4863, Level 16, State 1, Line 1
Bulk load data conversion error (truncation) for row 6, column 8 (bytes2).
Msg 4863, Level 16, State 1, Line 1
Bulk load data conversion error (truncation) for row 7, column 11 (domain).
Msg 4863, Level 16, State 1, Line 1
Bulk load data conversion error (truncation) for row 8, column 11 (domain).
Msg 4863, Level 16, State 1, Line 1
Bulk load data conversion error (truncation) for row 9, column 11 (domain).
Msg 4863, Level 16, State 1, Line 1
Bulk load data conversion error (truncation) for row 10, column 8 (bytes2).
Msg 4863, Level 16, State 1, Line 1
Bulk load data conversion error (truncation) for row 11, column 11 (domain).
Msg 4865, Level 16, State 1, Line 1
Cannot bulk load because the maximum number of errors (10) was exceeded.
Msg 7399, Level 16, State 1, Line 1
The OLE DB provider "BULK" for linked server "(null)" reported an error. The provider did not give any information about the error.
Msg 7330, Level 16, State 2, Line 1
Cannot fetch a row from OLE DB provider "BULK" for linked server "(null)".
Can someone please help!
Thanks!
November 27, 2008 at 2:59 pm
I did two changes and it worked:
domainvarcharno20--Increased length of domain column
Second:
WITH(FIELDTERMINATOR = ',',ROWTERMINATOR = '')--Changing row terminator.
MJ
Viewing 2 posts - 1 through 1 (of 1 total)
You must be logged in to reply to this topic. Login to reply