Testing for presence of a character in a CASE statement

  • I'm trying to find a way to look out for a certain character in a CASE statement.

    e.g:

    CASE

     WHEN 

          FUNCTION1(NAME,'/')

    THEN 

    Is there a built in function that can do be used like this inside a CASE statement?

     

    Thanks

  • Something like this?

    use pubs

    go

    select au_lname,

     case when charindex('l',au_lname)>0 then au_lname else 'FRANK' end

    from

     authors

    ?

    --
    Frank Kalis
    Microsoft SQL Server MVP
    Webmaster: http://www.insidesql.org/blogs
    My blog: http://www.insidesql.org/blogs/frankkalis/[/url]

  • That'll do nicely....

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply