做个查询,条件比较多,
大致意思如下:
declare @strSQL varchar(1000)--select * from table where col1 = '' and col2 = ''select @strSQL = ?
querry语句 是注释那条.@strSQL 该怎么写。
exec @strSQL

解决方案 »

  1.   

    declare @strSQL varchar(1000)
    --select * from table where col1 = '' and col2 = ''
    select @strSQL = 'select * from table where col1 = '''' and col2 = '''''
    exec(@strSQL)
      

  2.   

    一個單引號用兩個代替即可另外, exec @strSQL 改為exec(@strSQL)
      

  3.   

    declare @strSQL varchar(1000)
    select @strSQL = 'select * from table where col1 = '''' and col2 = '''''
    exec(@strSQL)