What is wrong with this statement

  • Hi All,

    What is wrong with this statement. Even when CHARINDEX is zero it goes thru the 2nd case statement:

    CASE WHEN CHARINDEX('-',ClientID) <> 0 THEN

    (CASE WHEN ISNUMERIC(SUBSTRING(ClientID,CHARINDEX('-',ClientID) + 1, 5)) = 1

    THEN CONVERT(INT,SUBSTRING(ClientID,CHARINDEX('-',vchClientSubSessionID) + 1, 5))

    ELSE ClientID END)

    ELSE ClientID END

    Thanks.

  • Duplicate post - refer to this link

    David

    @SQLTentmaker

    “He is no fool who gives what he cannot keep to gain that which he cannot lose” - Jim Elliot

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

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