SQL Server Bulk Insert failing when called from .NET SqlCommand
Posted
by
Nick Wright
on Stack Overflow
See other posts from Stack Overflow
or by Nick Wright
Published on 2009-01-16T00:37:54Z
Indexed on
2011/11/18
17:51 UTC
Read the original article
Hit count: 411
I have a stored procedure which does bulk insert on a SQL server 2005 database. When I call this stored procedure from some SQL (passing in the name of a local format file and data file) it works fine. Every time.
However, when this same stored procedure gets called from C# .NET 3.5 code using SqlCommand.ExecuteNonQuery it works intermittently.
When it fails a SqlException is generated stating "Cannot bulk load. Invalid column number in the format file "c:\bulkinsert\MyFile.fmt"
I don't think this error message is correct.
Has anyone experienced similar problems with calling bulk insert from code?
Thanks.
© Stack Overflow or respective owner