可以这样
exec('select a as '+@col+' from table')

解决方案 »

  1.   

    exec('select a as '+@col+' from table')
      

  2.   

    那外面的变量可以这样写吗?
    exec('select a as '+@col+' from table where date='+@date)
    这样对吗?
      

  3.   

    exec('select a as '+@col+' from table where date='''+@date+'''')
      

  4.   

    THANK YOU!
    可以让表里所有的NULL值改为0吗?
      

  5.   

    可以改变某一列的null 为零  类型要为数字型update 表 set col=0 where col is null