|
|
|
SSC-Addicted
      
Group: General Forum Members
Last Login: Tuesday, December 07, 2010 8:13 AM
Points: 436,
Visits: 322
|
|
tommyh (7/6/2010)
UMG Developer (7/6/2010)
Nice question, thanks! I'm a little surprised that so many people have gotten it correct so far, but that may be because of the copy, paste, F5 syndrome.  Or copy, paste, alt+x syndrome (F5 is to far away on the keyboard... and actually clicking execute is WAY out of the question). Good question though.
I have been wondering what the keyboard shortcut is for execute is. I learned 2 things today. By the way, this is not that hard to figure out without a copy and paste. I figured that 1,2 for both queries was too obvious; then I realized that one table is a variable so it probably would not be affected by the rollback. I guessed right. And I am assuming that rolling back a transaction does not change any type of variable to the pre-transaction value?
|
|
|
|
|
SSC Veteran
      
Group: General Forum Members
Last Login: Wednesday, December 12, 2012 11:38 AM
Points: 265,
Visits: 116
|
|
I like these kind of QOD because they point out the subtle differences in very similar things. After reviewing the post, I have been schooled and am better for it. Regarding the F5 cheating issue, I guess it's a matter of perspective on what game you are playing. For me, I guess I am not playing the traditional game but have engaged in another way of learning, I am just monitoring activity, and learning a lot along the way.
|
|
|
|
|
Ten Centuries
      
Group: General Forum Members
Last Login: Thursday, May 16, 2013 9:42 AM
Points: 1,072,
Visits: 1,026
|
|
Good QotD: Brief, straightforward illustration of something that may be well-known but was new to me.
I must be missing something. In Hrvoje's example, I understand why there are no rows in #t but I don't understand why the 'A' row isn't in @t. Is it because the output into #t fails?
|
|
|
|
|
SSCertifiable
       
Group: General Forum Members
Last Login: Today @ 2:32 PM
Points: 5,293,
Visits: 7,229
|
|
wware (7/7/2010) I must be missing something. In Hrvoje's example, I understand why there are no rows in #t but I don't understand why the 'A' row isn't in @t. Is it because the output into #t fails? That is because the statement fails. If a statement fails, it has no effect. Not on tables, nor on variables - and hence, not on table variables eiter. "SELECT @StringVar = 'a', @IntVar = 'a'" would leave both variables unaffected as well.
Hugo Kornelis, SQL Server MVP Visit my SQL Server blog: http://sqlblog.com/blogs/hugo_kornelis
|
|
|
|
|
Right there with Babe
      
Group: General Forum Members
Last Login: Tuesday, December 07, 2010 12:55 AM
Points: 771,
Visits: 504
|
|
Excellent question. I learned something new from all the other posts, too.
|
|
|
|
|
SSCrazy
      
Group: General Forum Members
Last Login: Tuesday, June 11, 2013 2:08 PM
Points: 2,121,
Visits: 2,226
|
|
Good question. Got it wrong, and now I know why.
Thanks, webrunner
------------------- "The chemistry must be respected." - Walter White
"A SQL query walks into a bar and sees two tables. He walks up to them and says 'Can I join you?'" Ref.: http://tkyte.blogspot.com/2009/02/sql-joke.html
|
|
|
|
|
SSCoach
         
Group: General Forum Members
Last Login: Today @ 5:03 PM
Points: 18,853,
Visits: 12,438
|
|
|
|
|
|
Forum Newbie
      
Group: General Forum Members
Last Login: Thursday, July 08, 2010 1:08 AM
Points: 1,
Visits: 1
|
|
Thank you
|
|
|
|
|
SSC Veteran
      
Group: General Forum Members
Last Login: Thursday, June 14, 2012 11:57 PM
Points: 257,
Visits: 595
|
|
| good question. Got the answer from the title
|
|
|
|
|
SSChasing Mays
      
Group: General Forum Members
Last Login: Saturday, April 06, 2013 12:20 AM
Points: 649,
Visits: 263
|
|
|
|
|