Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Error trapping
Message
From
12/07/2001 12:27:44
 
 
To
All
General information
Forum:
Microsoft SQL Server
Category:
SQL syntax
Title:
Error trapping
Miscellaneous
Thread ID:
00529790
Message ID:
00529790
Views:
48
Hi All,

is any one can chek the following s.p that i am using the right positions for begin trans, commit trans and error. i have doubt if insertion is failed what will happen it will first try to commit or will give an error number.

thanks,


CREATE Procedure udsp_insert_ExamMasterList
@ExamID char (2),
@ExamName varchar (20),
@Fees money,
@ExpiryMonths smallint,
@ExamDescription varchar(100),
@KdeId kdeid,
@KdeDate datetime

As
Begin

set nocount on

begin transaction

Insert tbl_ExamMasterList
(ExamID,ExamName,Fees,ExpiryMonths,ExamDescription,
kdeid, kdedate)
Values
(@ExamID,@ExamName,@Fees,@ExpiryMonths,@ExamDescription,
UPPER(@kdeid), getdate())

commit transaction

if @@error <> 0
begin
return @@error
rollback
end
else
return 0

End
Next
Reply
Map
View

Click here to load this message in the networking platform