|  | Posted by barmatt80 on 01/03/08 18:06 
I am stumped on the error reporting with sql server.  I was told ineed 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]
 
 I can execute the procedure using this:
 
 [code]exec usp_AcceptLeaveBalance 123456789, 10, 10, null, 10[/code]
 
 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.
  Navigation: [Reply to this message] |