January 13, 2014 at 12:57 pm
Sean Lange (1/13/2014)
I will ignore your comment about suggesting that always using NOLOCK is a good idea when integrity of the results is not important. :w00t:
I'm sure he meant that WITH(NOLOCK) should always be used instead of NOLOCK only when the hint is mandatory and not when integrity of the results is not important.
January 13, 2014 at 1:00 pm
I will ignore your comment about suggesting that always using NOLOCK is a good idea when integrity of the results is not important.:w00t:
To be clear (and to avoid being the guy who suggested someone use always use NOLOCK in any situation) I do want to point out that I included the caveat, "If NOLOCK is required..." I think my point would have been clearer if I said: If there is a requirement to use NOLOCK then use the always use WITH. That said, I can't think of a good reason to use NOLOCK and aver that a requirement that anyone must use NOLOCK is ridiculous. 😉
Edit: Just Louis' response; that is what I meant... Thank you sir.
-- Itzik Ben-Gan 2001
January 13, 2014 at 2:27 pm
Alan.B (1/13/2014)
I will ignore your comment about suggesting that always using NOLOCK is a good idea when integrity of the results is not important.:w00t:
To be clear (and to avoid being the guy who suggested someone use always use NOLOCK in any situation) I do want to point out that I included the caveat, "If NOLOCK is required..." I think my point would have been clearer if I said: If there is a requirement to use NOLOCK then use the always use WITH. That said, I can't think of a good reason to use NOLOCK and aver that a requirement that anyone must use NOLOCK is ridiculous. 😉
Edit: Just Louis' response; that is what I meant... Thank you sir.
Yes 10000% agreed. I must have misread your original post and/or was just being a pissy boy at that moment. My comment was unintentionally (and hopefully uncharacteristically) rude. My apologies if I offended you, I certainly did not mean any.
_______________________________________________________________
Need help? Help us help you.
Read the article at http://www.sqlservercentral.com/articles/Best+Practices/61537/ for best practices on asking questions.
Need to split a string? Try Jeff Modens splitter http://www.sqlservercentral.com/articles/Tally+Table/72993/.
Cross Tabs and Pivots, Part 1 – Converting Rows to Columns - http://www.sqlservercentral.com/articles/T-SQL/63681/
Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs - http://www.sqlservercentral.com/articles/Crosstab/65048/
Understanding and Using APPLY (Part 1) - http://www.sqlservercentral.com/articles/APPLY/69953/
Understanding and Using APPLY (Part 2) - http://www.sqlservercentral.com/articles/APPLY/69954/
November 1, 2015 at 3:56 am
GilaMonster (1/9/2014)
The first is deprecated, the second is not, both can result in incorrect results, duplicate rows and missing rows, so neither is the best to use. Best is to write the SQL properly without hints.
Hi Gila,
What if we applied READ_COMMITTED_SNAPSHOT ISOLATION LEVEL on the database level? would that be enough to return only committed & not dirty data?
Thanks & Best Regards,
Hany Helmy
SQL Server Database Consultant
November 4, 2015 at 8:33 pm
I would suggest (if NOLOCK is a requirement) to use NOLOCK, not WITH (NOLOCK).
NOLOCK without brackets is not a hint, but a table name alias.
So, the query would be using appropriate transaction isolation and no dirty reads would be involved.
:hehe:
_____________
Code for TallyGenerator
November 4, 2015 at 11:08 pm
Sergiy (11/4/2015)
I would suggest (if NOLOCK is a requirement) to use NOLOCK, not WITH (NOLOCK).NOLOCK without brackets is not a hint, but a table name alias.
So, the query would be using appropriate transaction isolation and no dirty reads would be involved.
:hehe:
BWAAAA-HAAAA! (Sorry... did that come out loud?) 😛
--Jeff Moden
Change is inevitable... Change for the better is not.
November 5, 2015 at 3:41 pm
Sergiy (11/4/2015)
I would suggest (if NOLOCK is a requirement) to use NOLOCK, not WITH (NOLOCK).NOLOCK without brackets is not a hint, but a table name alias.
So, the query would be using appropriate transaction isolation and no dirty reads would be involved.
:hehe:
Haha. Brilliant!
-- Itzik Ben-Gan 2001
Viewing 7 posts - 16 through 21 (of 21 total)
You must be logged in to reply to this topic. Login to reply