Using WITH (NOLOCK) in T-SQL?

Nolock is T-Sql hint, That used to ignore the locks on table during transactions. It allows retrieving data and did not wait to complete the transaition applied on table. It has some pros can cons

Pros:

  • NoLock provides significant improvements on large table, where upserts commands take time.
  • You can retirve data during the same time while others are performing Insert and update on table.

Cons:

  • Possibility of data that was partially updated or inserted, because you retrieve data during update or insert on table.
  • It often results in very obscure, hard to reproduce bugs and can cause data to get corrupted.

alirazazaidi

Ali Raza Zaidi, Microsoft ERP Consultant, Currently working for Business Experts Gulf in United Arab Emirates. Specialized in HR & Payroll, Supply Chain and Financials modules.