What is a NOLOCK?
Answers were Sorted based on User's Feedback
Answer / michael
Advantage:
applying nolock in select statement will increase
concurreny and performance in fetching.
Disadvantage:
it does'nt consider the transaction scenario, even if the
transaction is under process not yet commited or rollback
it will fetch the current record
eg
begin tran
insert into tablename
values('1','asdf')
select * from tablename with (nolock)
-- it will display the table with inserted record.
but the transaction is not completed, it can be rollback
so it became dirty read.
Is This Answer Correct ? | 28 Yes | 2 No |
Answer / naren
Using NOLOCK politely asks SQL Server to ignore locks and
read directly from the tables. This means you completely
circumvent the lock system, which is a major performance
and scalability improvement. However, you also completely
circumvent the lock system, which means your code is living
dangerously. You might read the not-necessarily-valid
uncommitted modifications of a running transaction. This is
a calculated risk.
Is This Answer Correct ? | 19 Yes | 1 No |
Answer / guest
Do not issue shared locks and do not honor exclusive locks.
When this option is in effect, it is possible to read an
uncommitted transaction or a set of pages that are rolled
back in the middle of a read. Dirty reads are possible. Only
applies to the SELECT statement.
Is This Answer Correct ? | 16 Yes | 3 No |
how to get max salary with employee number by using one select query and max function ??
Department ----------- salary Deptname 1000 A 3000 A 2000 B 3000 B 4000 C 5000 C select the deptname where salary >=5000 result should be: Deptname --------- C please post only executed query in SQL server 2005 Asked By: Md. Niyaz
Is sql server 2016 free?
How to specify the collation for a character data type in ms sql server?
How to write a query with an inner join in ms sql server?
What is cursors? And what are the different types of cursor?
select the 3rd maximum salary from sql server database if 4 (just an example In practically I may not know the exact situation) of the highest salaries are equal.
What is best institute to Learn DotNET And SQL in chennai?
Do you know spatial data types - geometry and geography in sql server 2008?
What is the definition for sql server 2000?
What is stretch database in sql server?
What are the different subsets of sql?