Log in
::
Register
::
Not logged in
Home
Tags
Articles
Editorials
Stairways
Forums
Scripts
Videos
Blogs
QotD
Books
Ask SSC
SQL Jobs
Training
Authors
About us
Contact us
Newsletters
Write for us
Recent Posts
Recent Posts
Popular Topics
Popular Topics
Home
Search
Members
Calendar
Who's On
Home
»
Article Discussions
»
Article Discussions by Author
»
Discuss content posted by ~~Hari.Bagra
»
DDL Rollback
12 posts, Page 1 of 2
1
2
»»
DDL Rollback
Rate Topic
Display Mode
Topic Options
Author
Message
Hari.Sharma
Hari.Sharma
Posted Saturday, October 03, 2009 11:08 AM
Ten Centuries
Group: General Forum Members
Last Login: Wednesday, December 26, 2012 12:43 PM
Points: 1,330,
Visits: 455
Comments posted to this topic are about the item
DDL Rollback
Cheers,
Hari
Tips & Tricks for SQL BI Developers
Post #797412
Richard Sisk
Richard Sisk
Posted Monday, October 05, 2009 8:19 AM
SSCommitted
Group: General Forum Members
Last Login: Tuesday, May 14, 2013 6:19 AM
Points: 1,879,
Visits: 205
Huh, what?! I got the following when I tested my answer...
(1 row(s) affected)
Msg 208, Level 16, State 1, Line 2
Invalid object name 'T'.
Where did I go wrong in my life...
Post #797927
Lynn Pettis
Lynn Pettis
Posted Monday, October 05, 2009 8:29 AM
SSC-Insane
Group: General Forum Members
Last Login: Today @ 11:55 AM
Points: 21,626,
Visits: 27,476
I had to fix the code (formatting, nothing else) when I tested the code in SSMS.
Lynn Pettis
For better assistance in answering your questions, click here
For tips to get better help with Performance Problems, click here
For Running Totals and its variations, click here
or
when working with partitioned tables
For more about Tally Tables, click here
For more about Cross Tabs and Pivots, click here
and
here
Managing Transaction Logs
SQL Musings from the Desert
Fountain Valley SQL
(My Mirror Blog)
Post #797947
Richard Sisk
Richard Sisk
Posted Monday, October 05, 2009 8:36 AM
SSCommitted
Group: General Forum Members
Last Login: Tuesday, May 14, 2013 6:19 AM
Points: 1,879,
Visits: 205
Sure, I reformatted as well, but that doesn't explain why my results were different than the posted answer. Here is the query I ran, looks the same as the QOD.
CREATE TABLE T ( ID int NOT NULL, Code varchar(10) NULL)
INSERT INTO T
SELECT 1,'AAAA'
GO
---------------------------------
BEGIN Tran t1
DROP TABLE T
ROLLBACK Tran
GO
---------------------------------
SELECT * FROM T
Post #797955
Lynn Pettis
Lynn Pettis
Posted Monday, October 05, 2009 8:39 AM
SSC-Insane
Group: General Forum Members
Last Login: Today @ 11:55 AM
Points: 21,626,
Visits: 27,476
No idea. I just copied your code to SSMS and it ran just fine returning the expected results.
Lynn Pettis
For better assistance in answering your questions, click here
For tips to get better help with Performance Problems, click here
For Running Totals and its variations, click here
or
when working with partitioned tables
For more about Tally Tables, click here
For more about Cross Tabs and Pivots, click here
and
here
Managing Transaction Logs
SQL Musings from the Desert
Fountain Valley SQL
(My Mirror Blog)
Post #797958
Richard Sisk
Richard Sisk
Posted Monday, October 05, 2009 9:07 AM
SSCommitted
Group: General Forum Members
Last Login: Tuesday, May 14, 2013 6:19 AM
Points: 1,879,
Visits: 205
Ack, weird. I tried it again and got the expected results as well. I hate Mondays.
Post #797978
ramonaraujop
ramonaraujop
Posted Monday, October 05, 2009 8:03 PM
Grasshopper
Group: General Forum Members
Last Login: Yesterday @ 9:51 AM
Points: 21,
Visits: 79
to do rollback in a right way,
I wrote:
-----------------
BEGIN Tran t1
DROP TABLE T
go
ROLLBACK
GO
----------------
SELECT * FROM T
the Question of the Day was wrong, I guess, so, was completed with errors.
The transaction was used before cross the word "go" so,
---------------------------------
BEGIN Tran t1
DROP TABLE T
ROLLBACK
Tran GO
---------------------------------
rollback doesn't raw
Post #798275
Chris Houghton
Chris Houghton
Posted Tuesday, October 06, 2009 3:46 AM
Mr or Mrs. 500
Group: General Forum Members
Last Login: Today @ 2:03 AM
Points: 557,
Visits: 1,357
I got it wrong, thought it was a trick question about aliasing transactions. I had forgotten you could do that, although it makes sense that you can now that I think about it. Shame on me!
Post #798392
Hari.Sharma
Hari.Sharma
Posted Tuesday, October 06, 2009 4:35 AM
Ten Centuries
Group: General Forum Members
Last Login: Wednesday, December 26, 2012 12:43 PM
Points: 1,330,
Visits: 455
ramonaraujop (10/5/2009)
to do rollback in a right way,
I wrote:
-----------------
BEGIN Tran t1
DROP TABLE T
go
ROLLBACK
GO
----------------
SELECT * FROM T
the Question of the Day was wrong, I guess, so, was completed with errors.
The transaction was used before cross the word "go" so,
I dont know why you are putting GO in between a transaction. As far as my understanding is concern, a transaction can't be splitted in two batches as you are doing by using GO.
Now come to the second point where you mentioned it a wrong question, but the question is all about DDL Rollback... Since it is mentioned in BOL that DDL statements cannot be rolled back then why the Table exists?
Cheers,
Hari
Tips & Tricks for SQL BI Developers
Post #798412
Lynn Pettis
Lynn Pettis
Posted Tuesday, October 06, 2009 6:24 AM
SSC-Insane
Group: General Forum Members
Last Login: Today @ 11:55 AM
Points: 21,626,
Visits: 27,476
Hari.Sharma (10/6/2009)
ramonaraujop (10/5/2009)
to do rollback in a right way,
I wrote:
-----------------
BEGIN Tran t1
DROP TABLE T
go
ROLLBACK
GO
----------------
SELECT * FROM T
the Question of the Day was wrong, I guess, so, was completed with errors.
The transaction was used before cross the word "go" so,
I dont know why you are putting GO in between a transaction. As far as my understanding is concern, a transaction can't be splitted in two batches as you are doing by using GO.
Now come to the second point where you mentioned it a wrong question, but the question is all about DDL Rollback... Since it is mentioned in BOL that DDL statements cannot be rolled back then why the Table exists?
The following is directly from the referenced link in the answer to this question:
Many types of operations are recorded in the transaction log, including:
The start and end of each transaction.
Every data modification (insert, update, or delete). This includes changes to system tables made by system stored procedures or data definition language (DDL) statements.
Every extent allocation or deallocation.
The creation or dropping of a table or index.
Lynn Pettis
For better assistance in answering your questions, click here
For tips to get better help with Performance Problems, click here
For Running Totals and its variations, click here
or
when working with partitioned tables
For more about Tally Tables, click here
For more about Cross Tabs and Pivots, click here
and
here
Managing Transaction Logs
SQL Musings from the Desert
Fountain Valley SQL
(My Mirror Blog)
Post #798447
« Prev Topic
|
Next Topic »
12 posts, Page 1 of 2
1
2
»»
Permissions
You
cannot
post new topics.
You
cannot
post topic replies.
You
cannot
post new polls.
You
cannot
post replies to polls.
You
cannot
edit your own topics.
You
cannot
delete your own topics.
You
cannot
edit other topics.
You
cannot
delete other topics.
You
cannot
edit your own posts.
You
cannot
edit other posts.
You
cannot
delete your own posts.
You
cannot
delete other posts.
You
cannot
post events.
You
cannot
edit your own events.
You
cannot
edit other events.
You
cannot
delete your own events.
You
cannot
delete other events.
You
cannot
send private messages.
You
cannot
send emails.
You
may
read topics.
You
cannot
rate topics.
You
cannot
vote within polls.
You
cannot
upload attachments.
You
may
download attachments.
You
cannot
post HTML code.
You
cannot
edit HTML code.
You
cannot
post IFCode.
You
cannot
post JavaScript.
You
cannot
post EmotIcons.
You
cannot
post or upload images.
Copyright © 2002-2013 Simple Talk Publishing. All Rights Reserved.
Privacy Policy.
Terms of Use.
Report Abuse.