View Single Post
  #7 (permalink)  
Old January 4th, 2008, 01:28 AM
urtrivedi urtrivedi is offline
Friend of Wrox
 
Join Date: Oct 2007
Location: , , .
Posts: 130
Thanks: 0
Thanked 3 Times in 3 Posts
Send a message via AIM to urtrivedi
Default

in the begining of procedure after keyword AS
BEGIN TRANSACTION

-YOUR CODE
-.....


IF (@@ERROR<>0)
   COMMIT TRANSACTION
ELSE
  ROLLBACK TRANSACTION

Also you should write one stored procedure for each table. do not write everthing in one procedure. Error message will come to your front end code directly. Print command will not help it will show message only if you execute query in query analyser.

urt