首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 数据库 > SQL Server >

用BCP 导入数据时碰到的有关问题

2012-01-18 
用BCP 导入数据时碰到的问题我建了个数据库:jacky下面有张表a执行:bcpjacky.dbo.aind:\district.txt-c-T结

用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 对文件内容有一定格式要求的, 不是随后一个文件都可以导入

热点排行