November 8, 2006 at 1:44 am
Hi
Begin tran
drop table <table name>
rollback
end tran
can any one help why the table is not droped and is rollbacked
November 8, 2006 at 2:09 am
Hi,
you are forcefully making a rollback and asking for why it should be rollback...
Begin tran
drop table <table name>
IF @@ERROR > 0
rollback
ELSE
commit
end tran
I think it would clear your problem and slove the question
cheers
November 8, 2006 at 3:34 am
Because drop table is a logged operation and you are reqesting a rollback ie undo everything up to where the transaction began.
By the way, your code shouldn't even run. You have a syntax error. There's no such statement as End Tran in SQL Server.
A transaction is started with Begin tran and ended with either Commit Transaction or rollback Transaction.
Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability
November 9, 2006 at 6:32 am
So what were you trying to accomplish with this code... and how can we help you with that?
November 9, 2006 at 11:19 pm
drop table <table name>
is this line is DML Statement
November 10, 2006 at 6:42 am
That question was already corectly answered. I have no idea what problem you are encountering. Can you tell us more about the process and the problems you are encountering?
Viewing 6 posts - 1 through 5 (of 5 total)
You must be logged in to reply to this topic. Login to reply