exec('
if (select 以太网 from 设备型号 where 型号='+@device_type+
            ...+'...'+
')=1)
这样语法就没有问题了。

解决方案 »

  1.   

    试试这样:
     declare @int int
     exec('select '+@int'+'=以太网 from 设备型号 where 型号='+@device_type)
     if @int=1 
      begin
        .....
      end
      

  2.   

    更正:
    exec('
    if (select 以太网 from 设备型号 where 型号='+@device_type+
                ...+'...'+
    ')=1)
    ')
    这样语法就没有问题了。
      

  3.   

    declare @temp int  --局部变量
    select @temp=以太网 from 设备型号 where 型号=@device_type
    if @temp=1
      select '是1'
    else
      select '不是1'