• RAISERROR is the way to go if you are going to throw an error up the chain.

    At the very least if you are using RETURN you should be giving RETURN a value so that your calling EXEC knows there was a failure.

    CREATE PROC dbo.myBad
       @myInt    int    = 0
    AS
       IF @myInt = 0
           RETURN 1    --- @myInt can't be 0
    GO
    DECLARE @myResult int
    EXEC @myResult = dbo.myBad
    IF @myResult <> 0
    BEGIN -- Error handling routine
        PRINT 'There was an error'
        .....
    END

     


    Julian Kuiters
    juliankuiters.id.au