消息 321,级别 15,状态 1,第 1 行
"城市" 不是可识别的表提示选项。如果它要作为表值函数的参数,请确保您的数据库兼容模式设置为 90。set @outp='where len(城市)<=10'exec ('select '+@sql+' from '+@city+'_'+@netadd+'_'+@op+'_data'+@outp) 
检测通过  运行  出现上面的提示

解决方案 »

  1.   

    问题是 我如果直接用
    exec   ('select   '+@sql+'   from   '+@city+'_'+@netadd+'_'+@op+'_data where len(城市)<=10')   是好用的
      

  2.   

    set   @outp='where len('+'城市'+') <=10' exec   ('select'+@sql+'from'+@city+'_'+@netadd+'_'+@op+'_data'+@outp)   
      

  3.   

    对不起大家  变量的 where字句前面少了个空格