Lock a single row in SQL Server from being selected -


can use lock, in sql server, such if select 1 record locked record should not returned other select query until lock has been removed.

below sample query:

sql table name : table1

let data in sql table : 1 column "name" having values ("abc","xyz","test") in 3 respective rows

so, if run select query lock below :

 select top 1 * table1 -- suppose query returns abc  

then if run same query in new query window (many times) should not return value "abc" until remove lock.

select * t (xlock, rowlock, holdlock) --disallow readers, lock on rows not pages or table somecondition 

this not block concurrent readers in snapshot mode, though. can't block those.


Comments

Popular posts from this blog

java - activate/deactivate sonar maven plugin by profile? -

python - TypeError: can only concatenate tuple (not "float") to tuple -

java - What is the difference between String. and String.this. ? -