日期:2014-05-18  浏览次数:20395 次

用BCP 导入数据时碰到的问题
我建了个数据库:jacky     下面有张表   a
执行:
bcp   jacky.dbo.a   in   d:\district.txt   -c   -T
结果:
Starying   copy...
SQLState   =   HY000,   NativeError=0
Error   =   [Microsoft][SQL   Native   Client]Unexpected   EOF   encountered   in   BCP   data-file
............
请问这个Error   大概是什么原因?

------解决方案--------------------
--导出语句

-- To allow advanced options to be changed.
EXEC sp_configure 'show advanced options ', 1
GO
-- To update the currently configured value for advanced options.
RECONFIGURE
GO
-- To enable the feature.
EXEC sp_configure 'xp_cmdshell ', 1
GO
-- To update the currently configured value for this feature.
RECONFIGURE
GO

exec master..xp_cmdshell 'bcp "jacky.dbo.a " out "D:\district.txt " -c -q -U "sa " -P "数据库密码 " '


------解决方案--------------------
要导入的文件格式不受 bcp 的支持

bcp 对文件内容有一定格式要求的, 不是随后一个文件都可以导入