本帖最后由 WX_yutou 于 2011-04-08 17:25:19 编辑

解决方案 »

  1.   


    create function f_f(
    @aa varchar(10)=''
    ,@bb varchar(10)=''
    ,@cc varchar(10)=''
    )
    returns @t table(xxxxx)
    as
    begin
    if @aa<>'' and @bb='' and @cc=''
    select * from tb into @t where xx=@aa
    else if @aa<>'' and @bb<>'' and @cc=''
        select * from tb into @t ....
     ...把组合写完
    return;
    end
     
      

  2.   


    不太明白!我如果只对@aa进行模糊查询“mn”或“po”  这个情况
      

  3.   

    --如果你不知道函数内部如何实现:
    select * from MYFUN
    (
      'mn',
      'null',
      'null'
    )
    union
    select * from MYFUN
    (
      'po',
      'null',
      'null'
    )
      

  4.   


    您说的or,不会是select * from MYFUN
    (
       'mn' or 'po',
       'null',
       'null'
    )