Stores Procedure with Conditions based on a parameter

  • WHERE ColumnA LIKE

    CASE

    WHEN @Type = 'TWO' THEN N'%' + N' 20-' + N'%'

    ELSE N'%' + N' [3-4]0-' + N'%'

    END

  • Thanks so much!

  • How do I say something equivalent to

    .....

    WHERE

    ColumnA LIKE

    CASE

    WHEN @Type = 'TWO' THEN N'%' + ' 20-' + N'%'

    WHEN @Type = 'THREE_FOUR' THEN N'%' + N' [3-4]0-' + N'%'

    WHEN @Type = 'OTHER' THEN ....NOT (N'%' + ' 20-' + N'%') OR (N'%' + N' [3-4]0-' + N'%')

    (ie: all others except those defined by the previous two parameters)

    END

    Any assistance most appreciated.

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

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