好象它会跳过,会发生字段"错位",提示什么" nvarchar 值 'abc' 转换为数据类型为 int 的列时发生语法错误。
--测试use pubs go--测试数据 create table test(a varchar(10),b varchar(10)) insert test select 'a',null union all select null,'b' union all select null,null union all select 'a','b' go--导出 exec master..xp_cmdshell 'bcp pubs..test out c:\a.csv /P"" /c /t","' go--删除表中的记录 truncate table test go--导入 exec master..xp_cmdshell 'bcp pubs..test in c:\a.csv /P"" /c /t","' go--显示导入结果 select * from test go--删除测试 drop table test/*--测试结果 a b ---------- ---------- a NULL NULL b NULL NULL a b(所影响的行数为 4 行)--*/
go--测试数据
create table test(a varchar(10),b varchar(10))
insert test select 'a',null
union all select null,'b'
union all select null,null
union all select 'a','b'
go--导出
exec master..xp_cmdshell 'bcp pubs..test out c:\a.csv /P"" /c /t","'
go--删除表中的记录
truncate table test
go--导入
exec master..xp_cmdshell 'bcp pubs..test in c:\a.csv /P"" /c /t","'
go--显示导入结果
select * from test
go--删除测试
drop table test/*--测试结果
a b
---------- ----------
a NULL
NULL b
NULL NULL
a b(所影响的行数为 4 行)--*/