得要通过这个来查询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

解决方案 »

  1.   

    select case 
    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
      

  2.   

    确定列类型
    尝试
    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
      

  3.   

    上面的方法不行就只能用查询select ''''+a+'''' as a ,b from kyzapp.dbo.tab导入到新表。然后在bcp了
      

  4.   

    BCP里面没有带那种参数,直接就可以把引号自动加上吗?因为在程序里调用这个BCP语句,已经把能导出文件了,但是又要求对于字符型的加上引号才行,我现在又不会了。实在是没有办法,希望大家能给我帮我解决。谢谢了。