Error handling in sql server

  • Hi,

    I am passing a varchar value into a stored procedure. This value can be a number string (like '123') or a regular string ('abc'). Inside the sproc, I want to do different things if it is one or the other. I am trying to do something like this.

    IF CAST(@val AS INT) returns no error

    ...do this...

    ELSE IF CAST(@val AS INT) returns an error

    ...do someting else

    Can any one tell me how to do this?

    Thanks.

  • You probably be better off using the ISNUMERIC() function.

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

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