Home All Groups Group Topic Archive Search About

Bulk Insert empty files

Author
21 Mar 2007 4:19 PM
meolivera
I have a T-SQL store procedure in SQL Server 2000 that bulk inserts a
text file into a table.

The code is like this:
BULK INSERT FT_MASK FROM 'e:\interfa\input\Cot\ftp\mdir.txt' WITH
(CODEPAGE='ACP')

The problem that I found is when mdir.txt is empty (0 bytes). Randomly
triggers the following error:
Bulk Insert fails. Column is too long in the data file for row 1,
column 1. Make sure the field terminator and row terminator are
specified correctly.
Server: Msg 7399, Level 16, State 1, Line 1
OLE DB provider 'STREAM' reported an error. The provider did not give
any information about the error.
Bulk Insert: DataFileType was incorrectly specified as char.
DataFileType will be assumed to be widechar because the data file has
a Unicode signature.
OLE DB error trace [OLE/DB Provider 'STREAM' IRowset::GetNextRows
returned 0x80004005:  The provider did not give any information about
the error.].
The statement has been terminated.

I said randomly, because trying even with the same file sometimes
there is no error and sometimes yes.

mdir.txt is generated by the ftp sentence "mdir"

AddThis Social Bookmark Button