Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Setting sql stmt as transactions in a stored proc

Author  Topic 

PGG123
Yak Posting Veteran

55 Posts

Posted - 2004-08-10 : 16:31:06
I have a stored proc that does a few updates on different tables. In my ASP code, I set begintrans and then do a commit or rollback whether or not there is an error returned after the stored proc is executed. I don't have the transactions statements in my stored proc.

Will my stored proc execute "all or nothing"?

Pat Phelan
Posting Yak Master

187 Posts

Posted - 2004-08-10 : 16:33:31
Without seeing all of the code I can't be certain, but it sure sounds like you'll be Ok to me.

-PatP
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2004-08-10 : 17:20:52
You need to check the value of @@ERROR after every single DML statement. If ever @@ERROR <> 0, then rollback.

Tara
Go to Top of Page

Lumbago
Norsk Yak Master

3271 Posts

Posted - 2004-08-10 : 18:10:04
Your procedure will execute all or nothing but using asp-transactions is not recomended...stick with the sql-server transactions.

--
Lumbago
"Real programmers don't document, if it was hard to write it should be hard to understand"
Go to Top of Page
   

- Advertisement -