Sometimes it does take a little bit time to finish off the rollback
(despite it indicates it is 100% completed'), but if the process still
there after let say good 10 mins. Run 'select * from sysprocesses' on
the master database and see if there is any lock problem there. Check
the 'blocked' field of the process.
Also check the SQL logs to see for any exceptions/errors. What SQL
platform you are on? What Service Pack you have installed.
Regards,
Mel
"MSLam" wrote:
> Sometimes it does take a little bit time to finish off the rollback
> (despite it indicates it is 100% completed'), but if the process still
> there after let say good 10 mins. Run 'select * from sysprocesses' on
> the master database and see if there is any lock problem there. Check
> the 'blocked' field of the process.
> Also check the SQL logs to see for any exceptions/errors. What SQL
> platform you are on? What Service Pack you have installed.
> Regards,
> Mel
>
Showing posts with label roll. Show all posts
Showing posts with label roll. Show all posts
Monday, March 12, 2012
Wednesday, March 7, 2012
question on failure inside a transaction
I want to issue a transaction where whole transaction should roll back
properly. I want to be sure that anything that stops these statements
from working will rollback the transaction. Example, the table2 no
longer exists below so I get error
Invalid object name 'table2'.
How do I get sql to gracefully rollback.. It seems to ignore my if
@.@.trancount > 0 rollback statement.
begin tran
insert into table1 (x,y,z) values(1,2,3)
insert into table2 (x,y,z) values(1,2,3)
if @.@.trancount > 0 rollback
commit tranAny severe error will stop the batch and any further code will not be run.
You might be able to use SET XACT_ABORT to do what you want or you can
handle it where you made the call in the first place.You might want to have
a look at this:
http://www.sommarskog.se/error-handling-II.html
Andrew J. Kelly SQL MVP
"David" <daveygf@.yahoo.com> wrote in message
news:1113009248.856813.214350@.o13g2000cwo.googlegroups.com...
>I want to issue a transaction where whole transaction should roll back
> properly. I want to be sure that anything that stops these statements
> from working will rollback the transaction. Example, the table2 no
> longer exists below so I get error
> Invalid object name 'table2'.
> How do I get sql to gracefully rollback.. It seems to ignore my if
> @.@.trancount > 0 rollback statement.
> begin tran
> insert into table1 (x,y,z) values(1,2,3)
> insert into table2 (x,y,z) values(1,2,3)
> if @.@.trancount > 0 rollback
> commit tran
>
properly. I want to be sure that anything that stops these statements
from working will rollback the transaction. Example, the table2 no
longer exists below so I get error
Invalid object name 'table2'.
How do I get sql to gracefully rollback.. It seems to ignore my if
@.@.trancount > 0 rollback statement.
begin tran
insert into table1 (x,y,z) values(1,2,3)
insert into table2 (x,y,z) values(1,2,3)
if @.@.trancount > 0 rollback
commit tranAny severe error will stop the batch and any further code will not be run.
You might be able to use SET XACT_ABORT to do what you want or you can
handle it where you made the call in the first place.You might want to have
a look at this:
http://www.sommarskog.se/error-handling-II.html
Andrew J. Kelly SQL MVP
"David" <daveygf@.yahoo.com> wrote in message
news:1113009248.856813.214350@.o13g2000cwo.googlegroups.com...
>I want to issue a transaction where whole transaction should roll back
> properly. I want to be sure that anything that stops these statements
> from working will rollback the transaction. Example, the table2 no
> longer exists below so I get error
> Invalid object name 'table2'.
> How do I get sql to gracefully rollback.. It seems to ignore my if
> @.@.trancount > 0 rollback statement.
> begin tran
> insert into table1 (x,y,z) values(1,2,3)
> insert into table2 (x,y,z) values(1,2,3)
> if @.@.trancount > 0 rollback
> commit tran
>
Labels:
backproperly,
database,
failure,
inside,
microsoft,
mysql,
oracle,
roll,
server,
sql,
statementsfrom,
stops,
transaction
Subscribe to:
Posts (Atom)