得要通过这个来查询column的类型
select case select col.xtype from sysobjects obj,syscolumns col where obj.id=col.id and obj.name = 'tabName'
35是text
167是varchar
175是char
231是nvarchar
select case select col.xtype from sysobjects obj,syscolumns col where obj.id=col.id and obj.name = 'tabName'
35是text
167是varchar
175是char
231是nvarchar
when (select col.xtype from sysobjects obj,syscolumns col where obj.id=col.id and obj.name = 'tab' and col.name='a') =175
then '''a'''
end as a
from a
尝试
create table tab (a char,b int)insert tab select 'a',1
union all select 'a',1
union all select 'a',1
union all select 'a',1bcp \"select ''''+a+'''' as a ,b from kyzapp.dbo.tab\" queryout e:\\temp\\____test.txt -c -t, -S178.156.1.1 -Usa -Psadrop table tab