Results 1 to 2 of 2

Thread: LOCK vs NOLOCK

  1. #1
    Join Date
    Dec 1969

    Default LOCK vs NOLOCK

    Can somebody tell me when it is appropriate to use NOLOCK on SELECT statements in a db query in a multiuser WIN2K ASP environment?<BR><BR>From what I understand, NOLOCK will do a dirty read to pull info from the db even though another user is getting ready to update the info from the same record. Wouldn&#039;t I want to perform a regular LOCK on the record until the user finishes updating the record so the other user can get the latest information? <BR><BR>If the user that is doing the dirty READ tries to do something else with the record, things might go wrong. I may be wrong, but I believe that the only time you should use a NOLOCK is when you&#039;re displaying a view of some records to the user and there is no other functionality that will enable the user to perform an action on that record.<BR><BR>Thanks for any input,<BR><BR>Bill.....

  2. #2
    Join Date
    Dec 1969
    Los Angeles, CA

    Default RE: LOCK vs NOLOCK

    You kinda answered your own question....<BR><BR>When i select data from the Db i always use nolock cause i am not going to do anythin with it other than view it...jsut checking for information...BUT...if i need to use that data to make changes or something like that i need a clean select.<BR><BR>Let us take for example i need to display the holidays for the year....why would i need a clean select...<BR><BR><BR>It all depends on your requirments....cause you sould understand a select without a nolock will LOCK the table....and somrtimes i do not need a lock...most of my SP in the Db select with a nolock cause i do not want a table to be locked even for a fration of a second....that is my requirment...what is yours<BR><BR>

Posting Permissions

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