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 2000 Forums
 Transact-SQL (2000)
 Row lock

Author  Topic 

jai2808
Starting Member

27 Posts

Posted - 2007-01-22 : 07:39:21
Hi,
I have a application, where users log in to the application and retrieve some records.but my problem is say is user a logs in he should get the first record and user b logs in he should get the second record.This way i want to implememt a lock so that no 2 users are viewing the same record.I have a uniquie column as recid.Could some one please help me with this.As it is very critical for my application.
Thanks in advance,
Jai

harsh_athalye
Master Smack Fu Yak Hacker

5581 Posts

Posted - 2007-01-22 : 07:45:30
What you want is custom locking mechanism. You can add a column in the table, say, IsLocked (a Int column) and When a particular user accesses the record, you can set his/her UserID in the IsLocked column for that record.

You can then check the status of the IsLocked column in the query to be 0 (record is not locked) to fetch only those records which are available.

Harsh Athalye
India.
"The IMPOSSIBLE is often UNTRIED"
Go to Top of Page
   

- Advertisement -