Finding Comma in the string

  • Guys,

    Declare @string VARCHAR(MAX)

    SET @string IN ('sql','server','2008')

    Here, How to find a comma in the above string?

    whether comma(,) exists or it is single value

    I want to solve the below example

    SELECT CASE WHEN @string = 'some string' THEN 'XYZ'

    WHEN @string IN (,) THEN 'abc' ---- the will be comma separated multiple value('sql','server','2008')

    FROM my_table

    If comma exist in the string then i want to print value.

  • I got the solution..

    CHARINDEX(',' ,@string) > 0

    Thanks

    Farooqh

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

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