I'm having a hard time trying to figure out how to lock a row within SQL 2000. Basically I want to lock a row with a specific lock type (i.e. exclusive) and then unlock it, how might one do this on a simple select statement for example?
This is an interesting question. It sent me to the SQL Server Books Online where I learned that SQL Server handles locking automatically;
that Locking Hints can be used in a SELECT statement, for example
Code:
SELECT au_lname FROM authors WITH (ROWLOCK)
that exclusive locks are used by SQL Server this way:"Exclusive (X) Used for data-modification operations, such as UPDATE, INSERT, or DELETE. Ensures that multiple updates cannot be made to the same resource at the same time."
The above will work, however why do you need to lock the row. Generally this is not needed in sql server if you are using transactions properly. Can you outline what you are doing?
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.