• I use RAISERROR myself and it works pretty well. I usually use this approach.

    IF NOT EXISTS (SELECT (a.VoucherNo) FROM GV_Voucher a WHERE a.TransactionID = @TransactionID AND a.VoucherNo = @LastVoucherNo)

    BEGIN

    RAISERROR('User Define: Invalid Last Voucher No |', 20, 1)

    RETURN;

    END;

    What I'm after is to check the value of a parameter or make sure rows exist where they need to and throw an error and terminate if there's a problem. It works very well. Just don't forget to add in a RETURN statement to terminate execution if there's an error that won't allow the rest of the procedure to run.