將過程中的 pPixes = @pixes
改為:charindex(pPixes,@pixes)>0

解决方案 »

  1.   

    IF (PATINDEX(@pixes,',')=0)
    begin
    set @tj=' where pPub=1 and pPixes = @pixes'
    +case when @pType is null then ''
    else ' and pType=@pType' end
    END 
    ELSE 
    begin
    --SET @pixes=REPLACE(@pixes,',',' or pPixes=')
    set @tj=' where pPub=1 and pPixes = '+REPLACE(@pixes,',',' or pPixes=')
    +case when @pType is null then ''
    else ' and pType=@pType' end
    END 
    ---------------------------------------------------------
    以上改成下面这句:set @tj=' where pPub=1 and (pPixes = '''+REPLACE(@pixes,',',''' or pPixes=''')+''')'+case when @pType is null then ''
    else ' and pType=@pType' end
      

  2.   

    to j9988(j9988)
    就是说把数字替换为用单引号刮起来了吧,ok;再测试看看..
      

  3.   

    to progress99(如履薄冰) 
    好象charIndex()可以得到,我那patIndex('%表达式1%','表达式2','表达式3')少了%,用错了吧
      

  4.   

    怎么说呢 zjcxc(: 邹建 :) and  j9988(j9988);
    这次提问,又看到你们了,本人运气不错哦,今天还是周六吧。
    ok,结帖好了,免得什么时候忘记叻,不值得太多讨论。