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.
| Author |
Topic |
|
AskSQLTeam
Ask SQLTeam Question
0 Posts |
Posted - 2002-11-12 : 08:50:48
|
| Anand Sharma writes "Hi I am facing a problem while locking some rows of a table SQL database.I am having a table named as "Users".I have written code in the following way.Begin transactionSelect * from userswith (HOLDLOCK , ROWLOCK)where userid = 10Problem is that nobody is able to update other rows also. I have locked only a singlerow with userid = 10 but it seems that the whole table is locked. Could u please help me out.SQL Server version = 7.0Window NT 4service pack = 6ThanxAnand" |
|
|
smccreadie
Aged Yak Warrior
505 Posts |
Posted - 2002-11-12 : 09:22:03
|
| Why are you row-locking? Seems like a better way would be to design your project so that explicit locking is not needed. |
 |
|
|
rihardh
Constraint Violating Yak Guru
307 Posts |
Posted - 2002-11-12 : 10:13:54
|
| Row locking is not, I repeat NOT intended for MSSQL. Drop that Access way of programing... |
 |
|
|
burbakei
Yak Posting Veteran
80 Posts |
Posted - 2002-11-13 : 13:42:24
|
| In SQL SERVER row level locking is enabled by default. but sometime sql serverpromotes row locking to page locking and even table locking. if your table is has a few rows that occupies only one or so pages it is likely that sql serverpropotes your row lock to table lock in order to (yes) consume less recources. |
 |
|
|
|
|
|