Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase ««1234»»»

Transactions Expand / Collapse
Author
Message
Posted Thursday, March 19, 2009 8:26 AM
SSC-Addicted

SSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-Addicted

Group: General Forum Members
Last Login: Friday, September 19, 2014 9:40 AM
Points: 413, Visits: 402
As a long-time Oracle DBA and a new MSSQL DBA I find this whole concept mind-boggling. If it hadn't been for the prior isolation-level question (which I missed) and then yesterday's (Guest) Editorial I would've gotten today's question wrong too.
Post #679465
Posted Thursday, March 19, 2009 8:36 AM
SSC Rookie

SSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC Rookie

Group: General Forum Members
Last Login: Wednesday, April 7, 2010 7:40 AM
Points: 42, Visits: 88
I expected to get no records because the transaction was still open but, when I ran it on SQL 2008 I got an error message saying "Msg 208, Level 16, State1, Line 3. Invalid object name 'test_tran'. Since this is the actual result I got I selected "None of the above" as the correct answer and was told I was wrong. I think I should get my "point" because my answer was technically correct.
Post #679478
Posted Thursday, March 19, 2009 8:42 AM


Ten Centuries

Ten CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen Centuries

Group: General Forum Members
Last Login: Monday, July 7, 2014 10:01 AM
Points: 1,136, Visits: 697
Good question because it made us think....I missed it, but I learned something which is really the point....It's very tough to cover all your bases on these questions....
Post #679486
Posted Thursday, March 19, 2009 8:56 AM
SSC-Addicted

SSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-Addicted

Group: General Forum Members
Last Login: Tuesday, December 7, 2010 8:13 AM
Points: 436, Visits: 322
Mine ran for a while with no results so being the impatient person I am I decided to see what would happen if I ran the first one again. Upon doing so it returned the first 2 rows (1 and 2) in the second query.
I am using SQL Server 2005.
Post #679508
Posted Thursday, March 19, 2009 9:10 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Sunday, March 22, 2009 10:55 PM
Points: 1, Visits: 1
dear Friends,

i have testing this question and return all values (1,2,3) if i execute it

thx
Post #679525
Posted Thursday, March 19, 2009 9:11 AM
Hall of Fame

Hall of FameHall of FameHall of FameHall of FameHall of FameHall of FameHall of FameHall of FameHall of Fame

Group: General Forum Members
Last Login: Thursday, July 17, 2014 10:56 AM
Points: 3,924, Visits: 1,607
Good question. I didn't read it correctly and executed in same window. Which gave me 1,2,3 but after it got wrong, then tried it in another window and it was still running.

Will see if it returns something after sometime.


SQL DBA.
Post #679530
Posted Thursday, March 19, 2009 9:12 AM
Hall of Fame

Hall of FameHall of FameHall of FameHall of FameHall of FameHall of FameHall of FameHall of FameHall of Fame

Group: General Forum Members
Last Login: Thursday, July 17, 2014 10:56 AM
Points: 3,924, Visits: 1,607
h84liang (3/19/2009)
dear Friends,

i have testing this question and return all values (1,2,3) if i execute it

thx


Dude, read question correctly. It say's execute it in another window and not the same.
Try again.


SQL DBA.
Post #679536
Posted Thursday, March 19, 2009 10:42 AM
Ten Centuries

Ten CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen Centuries

Group: General Forum Members
Last Login: Friday, August 10, 2012 6:08 PM
Points: 1,156, Visits: 801
Sometimes missing information in a question induces thought, teaches, and also helps one to permanently retain what was learned.

I think this was a great question, and also the points brought out in discussion.
Post #679655
Posted Thursday, March 19, 2009 11:02 AM


SSC-Insane

SSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-Insane

Group: General Forum Members
Last Login: Today @ 11:02 AM
Points: 20,703, Visits: 32,345
LGibson69 (3/19/2009)
I expected to get no records because the transaction was still open but, when I ran it on SQL 2008 I got an error message saying "Msg 208, Level 16, State1, Line 3. Invalid object name 'test_tran'. Since this is the actual result I got I selected "None of the above" as the correct answer and was told I was wrong. I think I should get my "point" because my answer was technically correct.


I am guessing you are running in a case-sensitive environment. I am too and had the same error. I corrected the second query to use the same EXACT name as the first. I then had the proper result (based on SNAPSHOT ISOLATION being OFF).



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 #679678
Posted Thursday, March 19, 2009 11:10 AM


Hall of Fame

Hall of FameHall of FameHall of FameHall of FameHall of FameHall of FameHall of FameHall of FameHall of Fame

Group: General Forum Members
Last Login: Thursday, September 25, 2014 2:58 PM
Points: 3,173, Visits: 1,267
At first I was confused about why it would not return the already committed data and I did an experiment by changing the code. Very interesting question. Thanks!

--first window
CREATE TABLE Test_Tran(id int identity, col1 int)
ALTER TABLE Test_Tran ADD CONSTRAINT [pk_Test_Tran] PRIMARY KEY CLUSTERED (id ASC)
insert into Test_Tran values(1)
insert into Test_Tran values(2)
Begin Tran
insert into Test_Tran values(3)

--second window
SET TRANSACTION ISOLATION LEVEL READ COMMITTED
select * from a_test_tran where id < 3

--results
id col1
----------- -----------
1 1
2 2

(2 row(s) affected)



Post #679685
« Prev Topic | Next Topic »

Add to briefcase ««1234»»»

Permissions Expand / Collapse