Results 1 to 4 of 4
  1. #1
    Join Date
    Oct 2014
    Posts
    268
    Provided Answers: 6

    Answered: Use of No Locks (query hints)

    Can you just call out nolock once or do you have to place the query hints in the all the joins?

    I've always just added them to the joins but was wondering if there was a way to call the hint out once.
    Last edited by VLOOKUP; 05-04-15 at 18:18.

  2. Best Answer
    Posted by Pat Phelan

    "Yes, you can but please do a bit of reading before you do... If you understand the trade offs, dirty reads can be great. If you don't understand the consequences, dirty reads can be terrible!

    See Bad Habits: Putting NOLOCK everywhere and the older but still appropriate SQL Server NOLOCK Hint & other poor ideas.. Once you understand the risks and benefits, you can use NOLOCK and the preferred READ UNCOMMITTED.

    Think before you use dirty reads!

    -PatP"


  3. #2
    Join Date
    Feb 2004
    Location
    In front of the computer
    Posts
    15,579
    Provided Answers: 54
    Yes, you can but please do a bit of reading before you do... If you understand the trade offs, dirty reads can be great. If you don't understand the consequences, dirty reads can be terrible!

    See Bad Habits: Putting NOLOCK everywhere and the older but still appropriate SQL Server NOLOCK Hint & other poor ideas.. Once you understand the risks and benefits, you can use NOLOCK and the preferred READ UNCOMMITTED.

    Think before you use dirty reads!

    -PatP
    In theory, theory and practice are identical. In practice, theory and practice are unrelated.

  4. #3
    Join Date
    Oct 2014
    Posts
    268
    Provided Answers: 6
    Yeah I decided to remove the nolock's this is sales data, I don't care if someone is locked I want the real read. Thanks

  5. #4
    Join Date
    Feb 2004
    Location
    In front of the computer
    Posts
    15,579
    Provided Answers: 54
    There are times when dirty reads are acceptable and when they are, they're great. There are other times (as you've discovered), when dirty reads are just a disaster in search of a victim.

    -PatP
    In theory, theory and practice are identical. In practice, theory and practice are unrelated.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •