| Author |
Topic |
|
korssane
Posting Yak Master
104 Posts |
Posted - 2009-03-24 : 13:53:27
|
| Hi All ,i am trying to import a text file from the server using BCP but i am getting this specific error :Msg 4832, Level 16, State 1, Line 1Bulk load: An unexpected end of file was encountered in the data file.Msg 7399, Level 16, State 1, Line 1The 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 1Cannot fetch a row from OLE DB provider "BULK" for linked server "(null)".Here is my Code :BULK INSERT [Database-name].[dbo].[ImportTable]FROM '\\Servername\File1.txt'WITH ( CODEPAGE='RAW', FIRSTROW = 2, FIELDTERMINATOR ='\t', ROWTERMINATOR = '\n' )GoAny suggestions will be greatly appreciated.THanks |
|
|
yosiasz
Master Smack Fu Yak Hacker
1635 Posts |
Posted - 2009-03-24 : 16:10:38
|
| what des the content of File1.txt look like and what does the structure of ImportTable look like |
 |
|
|
korssane
Posting Yak Master
104 Posts |
Posted - 2009-03-24 : 16:44:19
|
| The text file resides in the server and when i open it it looks like collumns with the 1st raw as a header.of course i have specify in the code above to ignore the 1st raw.The ImportTable has the same number of fields (39) all of them are set to "nvarchar(MAX) ".Now, i know that is my file cuz i have tried to open another text file form another location and it worked fine.Any suggestions ?Thanks |
 |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
|
|
korssane
Posting Yak Master
104 Posts |
Posted - 2009-03-25 : 08:47:56
|
| Hi ,this works when i removed the end of the file which was a square symbol. The thing is : this file is automatically created every day. Q1- is there a way to ignore the end of the file ?Q2- Is there a way to run the query daily @ 08:00AM in order to update this table. ?thank a lopt for the help. |
 |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2009-03-25 : 08:51:13
|
Import the file content into a staging table first.Then insert into original table from this staging table where (the column where the "square" is stored) <> CHAR(10) <-- or 13 depending which ascii value the "square" is. E 12°55'05.63"N 56°04'39.26" |
 |
|
|
korssane
Posting Yak Master
104 Posts |
Posted - 2009-03-25 : 08:58:33
|
| Sorry,i am not following you.please, can you be more explicit.The daily table is daily generated and i can not do change on it ?Thanks |
 |
|
|
korssane
Posting Yak Master
104 Posts |
Posted - 2009-03-25 : 09:15:45
|
| Hi ,Here is the symbol in the end of the file "" . it is basically a square. |
 |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
|
|
|