I am stumped on the error reporting with sql server. I was told i
need to return @SQLCode(code showing if successful or not) and
@ErrMsg(and the message returned). I am clueless on this.
I wrote this procedure:
I can execute the procedure using this:
Sql comments that it is successful and that 0 rows are changed. I
know it shouldn't be successful because 123456789 does not refer to
any SSN.
So i am just inquring how to do the error handling and secondly I am
guessing I need to check to see if the ssn exists first.
Any suggestions or help.
I greatly appreciate it, and thanks for the help.
need to return @SQLCode(code showing if successful or not) and
@ErrMsg(and the message returned). I am clueless on this.
I wrote this procedure:
Code:
ALTER PROCEDURE [dbo].[usp_AcceptLeaveBalance] @Emp_SSN int, @Annual_Forward decimal(10,2), @Sick_Forward decimal(10,2), @Family_Forward decimal(10,2), @Other_Forward decimal(10,2) AS UPDATE OT_MAIN SET EmpAnnual_Forward = IsNull(@Annual_Forward, EmpAnnual_Forward), EmpSick_Forward = IsNull(@Sick_Forward, EmpSick_Forward), EmpFamily_Forward = IsNull(@Family_Forward, EmpFamily_Forward), EmpOther_Forward = IsNull(@Other_Forward, EmpOther_Forward) WHERE Emp_SSN=@Emp_SSN
Code:
exec usp_AcceptLeaveBalance 123456789, 10, 10, null, 10
know it shouldn't be successful because 123456789 does not refer to
any SSN.
So i am just inquring how to do the error handling and secondly I am
guessing I need to check to see if the ssn exists first.
Any suggestions or help.
I greatly appreciate it, and thanks for the help.
Comment