March 11, 2008 at 5:01 am
I try to load the text file to sqlserver in my local system,in text file i've take only one column
and take the to columns in database now i load the file then i give the FIELDTERMINATOR= '\t', ROWTERMINATOR= '',.
so evry time i give the 'tab' each and every column value finally give the 'enter' in text file after that save the text file.than only it'll execute,with out giveing tab,enter it 'll show an error msg like
(Msg 4832, Level 16, State 1, Line 1
Bulk load: An unexpected end of file was encountered in the data file.
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)".)
so with out giveing tab and enter how i can load that file
March 11, 2008 at 5:16 am
Don't use either terminator in the code... the defaults are probably correct for your single column text file.
--Jeff Moden
Change is inevitable... Change for the better is not.
March 11, 2008 at 5:39 am
Hi,
Plz make sure source file and target table column should be same and use this script :
BULK INSERT table_name FROM 'D:\file.txt' WITH (FIELDTERMINATOR = '\t',firstrow=1)
firstrow is optional :
Best Regards
Faheem latif
Senior Database Architect
Genie Technologies (Pvt.) Ltd.
March 11, 2008 at 5:56 am
You need to explain the rest... first row, even if you skip it, must have the same number and type of delimiters or the second row may cause an error or be included as part of the first row in error.
--Jeff Moden
Change is inevitable... Change for the better is not.
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply