General information
Forum:
Microsoft SQL Server
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
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only