Results 1 to 3 of 3
  1. #1
    Join Date
    Nov 2002
    Posts
    19

    Unanswered: Are there wild cards for the = ???

    I have a stored procedure where I'd like to be able to say


    ...
    ....
    ...
    where FldName='*' if the fieldvalue was passed as null or
    where fldName='whatever' if the fieldvalue was passed as non-null.

    is this possible? Is there a workaround?
    DerFarm
    It IS as bad as you think
    and they ARE out to get you

  2. #2
    Join Date
    Feb 2003
    Location
    Germany
    Posts
    53

    Re: Are there wild cards for the = ???

    Originally posted by DerFarm
    I have a stored procedure where I'd like to be able to say


    ...
    ....
    ...
    where FldName='*' if the fieldvalue was passed as null or
    where fldName='whatever' if the fieldvalue was passed as non-null.

    is this possible? Is there a workaround?

    try this

    ... where ( FldName is Null ) or ( FldName = 'whatever' )

  3. #3
    Join Date
    Nov 2002
    Posts
    19
    Thanks, but where (fldname is null) will only match if the fldname is null ... not if John is in there.

    I think I found the answer in a left join. I can left join the table to itself on the field in question and return only if the proper username is there.

    Thanks
    DerFarm
    It IS as bad as you think
    and they ARE out to get you

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •