BCP错误:仅当复制到服务器时,才可以跳过列 [英] BCP Error: columns may be skipped only when copying into the Server
问题描述
当我发出此命令时(它看起来很傻,但是可以正常工作):
When I issue this command (It looks silly but it works):
BCP "declare @colnames varchar(max); select @colnames=coalesce (@colnames+char(9), '')
+ Column_Name from db.information_Schema.columns where table_name='table1' order by
ordinal_position; select @colnames"
queryout Table1_Columns.tsv -S?? -U?? -P?? -f** -e**
我收到此错误:
[Microsoft] [SQL Native Client]仅在以下情况下可以跳过主机文件列 复制到服务器
[Microsoft][SQL Native Client]Host-file columns may be skipped only when copying into the Server
格式文件为:
9.0
1
1 SQLCHAR 0 100 "\r\n" 1 Column_Names SQL_Latin1_General_CP1_CI_AS
有人可以告诉我为什么出现此错误吗?
Can someone tell me why I am getting this error?
推荐答案
There's an active bug report for this: http://connect.microsoft.com/SQLServer/feedback/details/584001/bcp-table-out-with-format-file-does-not-work-if-file-specifies-less-columns-than-source-table.
一种简单的解决方法是将变量写入临时表(不是#temptable,而是临时表),然后从该表中删除bcp
.
One simple workaround would be to write the variable to a temporary table (not a #temptable, but rather a table that is temporary), and bcp
out from that.
这篇关于BCP错误:仅当复制到服务器时,才可以跳过列的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!