June 19, 2010 at 1:52 am
Dear Sir,
I have written a store procedure which inserts data into a table1 using sql statement after that a store procedure is called which insert data into a another table. both statements executed in transaction batch. but here if table1 is failed control go to err_handler and execute rollback transaction. there fore no one table updated. but in my store procedure
if 1st table is failed to inser data then flow-of-control execute the next called store procedure. therefore 2nd table is updated. how it is possible !
here I am attatching my store procedure.
Thanking You
Debasis Bag;-)
June 19, 2010 at 12:16 pm
PLease be aware of: (From Books On Line)
Because @@ERROR is cleared and reset on each statement executed, check it immediately following the statement being verified, or save it to a local variable that can be checked later.
You need to add error checking in your procedure
Begin
Insert into ProcessTran(ProcessId,JobId,ModelId,ClientId,LotId,SlipNo,SlipDt,Trno,LotQty,
QtyIn,QtyOut,Rejected,WsId,WsId_To,StoreId,StoreId_To,Login_Id)
Values(@ProcId,@JobId,@ModelId,@ClientId,@LotId,@SlpNo,@Slpdt,@Trno,@LotQty,@Qtyin,@QtyOut,
@Rej,@WsId,@WsId_To,@StId,@StId_To,@Log_Id)
-- Insert additional error checking here:
If @@Error<>0 GoTo Err_Handler
Viewing 2 posts - 1 through 1 (of 1 total)
You must be logged in to reply to this topic. Login to reply