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)
 Rowlock locks the whole table

Author  Topic 

sqlilliterate
Starting Member

40 Posts

Posted - 2008-07-16 : 03:32:52
I'm using ROWLOCK in my select statement, to lock a particular row...

begin tran
Select * from <table>(with ROWLOCK) where <column1> = <value1>

but when I try to update the same record in a different session, it is not getting updated since it is locked...

But if i try to update a different row in the table, it is not allowing that too... and I'm able to update any record in the table only if I commit the transaction...

I'm not sure why the ROWLOCK is locking the complete table instead of the row...
* My table DOES NOT contain any Indexes...

Your thoughts in this regard would immensely help me... and correct me if am wrong anywhere...

thans in advance...

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2008-07-16 : 04:10:02
It is the TRANSACTION that locks the records, until a COMMIT or ROLLBACK is performed.



E 12°55'05.25"
N 56°04'39.16"
Go to Top of Page
   

- Advertisement -