Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 locking question.

Author  Topic 

torust
Starting Member

5 Posts

Posted - 2008-08-25 : 12:04:23
Actually, I want to lock a record to not allow other clients to update, query, delete the record until I run the commit or rollback statement. But I can query , update or delete other records no matter the record is committed or not.

How can I do that?

Thanks

Vinnie881
Master Smack Fu Yak Hacker

1231 Posts

Posted - 2008-08-25 : 13:28:38
Read this

http://sqldbpool.wordpress.com/2008/03/19/transactions-and-locks-in-sql-server/

It will help explain what actually happens in a transaction and how locks are implemented.
Go to Top of Page

spirit1
Cybernetic Yak Master

11752 Posts

Posted - 2008-08-25 : 13:32:00
use serializable transaction isolation level.

_______________________________________________
Causing trouble since 1980
Blog: http://weblogs.sqlteam.com/mladenp
Speed up SSMS development: www.ssmstoolspack.com <- version 1.0 out!
Go to Top of Page

torust
Starting Member

5 Posts

Posted - 2008-08-25 : 20:24:11
I know that how locks are implemented. But it seems that the behaviour in SQL 2005 is quite different from SQL 2000. What I work in 2000 does not work in 2005. No matter how I implement rowlock , xlock or holdlock in the select statement or update in specify record, I can't select , update or delete other records. It holds other clients even though I query other records, not the specify record
Go to Top of Page
   

- Advertisement -