Puiu Posted December 11, 2005 Posted December 11, 2005 I have a stored procedure that makes an insert into a database. Something like create proc InsAgent @Name varchar(100), @Age varchar(10), @Message varchar(100) output as insert into Agent values(@Name,@Age) set @Message='Success' My questions: 1. is it worth to use transactions with this kind of stored proc ? 2. If i want to exit a stored procedure i should type return In some cases i saw "return" followed by a number: return 11 or return 10... Is there any use for that number ? Quote
kejpa Posted December 12, 2005 Posted December 12, 2005 Hi, if this is the only insert/update/delete you do then using transactions is overkill. You should use transactions if you do multiple changes in the database that have to be all successful. It's not the case here, at least not from what you've shown. HTH /Kejpa Quote
*Experts* Nerseus Posted December 12, 2005 *Experts* Posted December 12, 2005 For the RETURN, I usually use RETURN 0 to indicate SUCCESS, but RETURN by itself works fine. Normally, a non-zero value indicates an error. It's typical to use "RETURN @@ERROR" in SQL Server. -ner Quote "I want to stand as close to the edge as I can without going over. Out on the edge you see all the kinds of things you can't see from the center." - Kurt Vonnegut
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.