Clear Errors

  • Can I clear errors when i am in the sp.

    because i want to run another sp if first statement retrned with error.

  • You can use @@error to determine if there is an error:

    if @@error <> 0 begin

    /* execute other statements and procedures in here */

    end

    Jeremy

  • thanks Jeremy Kemp.

    still it give me runtime error on vb app. (i execute the sp from vb, by giving "exec sp_kkk" )

    i want to clear errors from sp and execute another statment in sp to return some data.

  • My VB isn't great but if you use OnError to trap the error, you can then include some specific error handling in VB to check for errors (Err.Number). You'll probably find that a certain set of 'errors' reported by SQL Server are not reportable errors and you can ignore them in your VB code.

    I have always found that SQL Server always returns an error if there is an error in executing an SP and it is up to the client app to determine what to do with that error.

    Jeremy

  • My VB isn't great but if you use OnError to trap the error, you can then include some specific error handling in VB to check for errors (Err.Number). You'll probably find that a certain set of 'errors' reported by SQL Server are not reportable errors and you can ignore them in your VB code.

    I have always found that SQL Server always returns an error if there is an error in executing an SP and it is up to the client app to determine what to do with that error.

    Jeremy

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

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