sql if

来源:互联网 发布:java线程池配置 编辑:程序博客网 时间:2024/05/30 23:38

declare @strs varchar(1000)

if   col_length( 'StockOrderInfo ',   'Code')   is  not  null
begin
        print   '存在 ' ;
  set @strs='update StockOrderInfo set Code=''jmltest'' where  guid=''BBEC48A5-514D-4829-962A-0000134A7BEC'''
end
else
 print '不存在'
if(len(@strs)>0)
 exec(@strs);