How to suppress an error

  • I have a stored procedure, which, if an insert fails because the record already exists, performs an update of the record. The code works fine, but an error is still returned back to ColdFusion saying the stored procedure failed. The error was technically handled exactly the way I want to handle it, so I do not want ColdFusion to think that the procedure failed. Is there a way to suppress this error notification?

    Thank you,

    Mike Chabot

  • Why not change the stored-procedure to try and perform the following?

    IF EXISTS (SELECT * FROM dbo.table WHERE criteria)

      BEGIN

        UPDATE...

      END

    ELSE

      BEGIN

        INSERT

      END



    Good Hunting!

    AJ Ahrens


    webmaster@kritter.net

  • Thank you. I went ahead and changed my stored procedure.

    If anyone knows how to suppress an error in SQL Server 2000, I would still be interested to know in case the question comes up in some other context.

    Thank you,

    Mike Chabot

  • Look at @@ERROR in Books Online.  Might give you what you need.

    Steve

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

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