display error message

  • I have this stored proc:

    CREATE Procedure sp_CenterDataTransfer (

    @Error_msgvarchar(255) = '' OUTPUT)

    DECLARE @iReturnValueint

    ......

    if @cntCenterRec > 0

    begin

    SET @error_msg = 'sp_CenterDataTransfer: On Insert – Duplicate Record In Database'

    GOTO ERR_HANDLER

    .....

    ERR_HANDLER:

    SET @iReturnValue = -1

    CLOSE center_cursor

    DEALLOCATE center_cursor

    return @iReturnValue

    GO

    I would like to have the error message display on the screen when there is a duplicate record but when I executed the stored proc it just came back with 'command executed successfully'. Did I miss something? Any help would be greatly apprecialted. Thanks a bunch

  • A return value is returned as in from a function. If you want it to print, then use SELECT or PRINT.

    Steve Jones

    steve@dkranch.net

  • If you perform a raiserror before the return that should be trapped by the error handler in your client - and you can pass the message that way too.


    Cursors never.
    DTS - only when needed and never to control.

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

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