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)
 nested transaction

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2001-12-03 : 08:34:27
biju writes "I AM USING sql 7.0 and i am using procedures to do the transactions . in every procedures i am using begin tran

insert into table a select @err1=@@error update table b select @err2=@@rowcount

if @err1=0 and @err2<>0 begin commit tran end else begin rollback tran end

by some how this procedure exited without issuing commit/rollback so all the subsequent transactions beccome nested transactions and remain open untill next roll back.

how can i avoid this .

can i use @@trancount in every procedure to check for any open transactions under that connections any ideas?"

nr
SQLTeam MVY

12543 Posts

Posted - 2001-12-03 : 09:39:16
You can use @@trancount but it is probably better to close the connection on any error and start a new one.
This seems to be another 'feature' that has appeared with v7 - you have to be especially careful in query windows.
Queries will exit and avoid error processing if things like constraint violations in triggers happen

==========================================
Cursors are useful if you don't know sql.
Beer is not cold and it isn't fizzy.
Go to Top of Page
   

- Advertisement -