2012年2月18日星期六

BCP Insert record error (SQL2005-Window 2003)

Hi All,

When we to inset record into the tables through BCP we are getting following errors.

C:\> bcp ACCT.dbo.dtpro out C:\test\dtpro_TA.dat -T-n
C:\>bcp ACCT.dbo.Semiaa out C:\test\Semiaa_TA.dat -T -n

BCP out works fine only BCP in have problems.

Please can you let me know how to resolved this problem.

===========
Exp - 1
===========

C:\> bcp ACCT.dbo.dtpro in C:\test\dtpro_TA.dat -T-n

Starting copy...
SQLState = HY000, NativeError = 0
Error = [Microsoft][SQL Native Client]Unexpected EOF encountered in BCP data-file

0 rows copied.
Network packet size (bytes): 4096
Clock Time (ms.) Total : 1

===========
Exp - 2
===========

C:\>bcp ACCT.dbo.Semiaa in C:\test\Semiaa_TA.dat -T -n

Starting copy...
SQLState = HY000, NativeError = 0
Error = [Microsoft][SQL Native Client]Unexpected EOF encountered in BCP data-file

0 rows copied.
Network packet size (bytes): 4096
Clock Time (ms.) Total : 1

============
Exp-3
============

C:\>bcp ACCT.dbo.SemiH in C:\test\SemiH_TA.dat -T -n

Starting copy...SQLState = HY000, NativeError = 0
Error = [Microsoft][SQL Native Client]Unexpected EOF encountered in BCP data-file
SQLState = 42000, NativeError = 7339
Error = [Microsoft][SQL Native Client][SQL Server]OLE DB provider 'STREAM' for l
inked server '(null)' returned invalid data for column '[!BulkInsert].Created'.


BCP copy in failed


Thanks in Advance

There are many reasons this error can happen. It could be, and often is, that the schemas of the databases are incompatible. Post a reply containing the schemas of these databases if you can. That would greatly help in diagnosing the problem.

Jay

|||

C:\>bcp ACCT.dbo.dtpro in C:\test\dtpro_TA.dat -T-n

Starting copy...
SQLState = HY000, NativeError = 0
Error = [Microsoft][SQL Native Client]Unexpected EOF encountered in BCP data-file

0 rows copied.
Network packet size (bytes): 4096
Clock Time (ms.) Total : 1
******************************************

table dtpro

[id] [int] NULL,
[objectid] [int] NULL,
[property] [varchar](64) NULL,
[value] [varchar](255) NULL,
[uvalue] [nvarchar](510) NULL,
[lvalue] [image] NULL,
[version] [int]NULL,

********************************************

|||The error message typically indicates some sort of corruption in the file due to invalid lines, invalid terminators etc. Can you try to create a dummy file on a different location and try? If you are using the file that you BCPed out then do that again but to a different location and try.|||

The schema seems simple enough. It seems odd that you can't import into the same table you exported from, since your table doesn't contain fields that would preclude that.

I would try what Umachandar suggested, and if that doesn't work, try and isolate which records might be causing the problems by using the -F and -L options of bcp to export subsets.

|||

Were you ever able to get this resolved?

Jay Kint

没有评论:

发表评论