Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Record locking
Message
De
09/03/2010 09:04:24
 
 
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Syntaxe SQL
Titre:
Divers
Thread ID:
01453377
Message ID:
01453432
Vues:
40
>>Hi
>>
>>What's the best way to lock a specific record within a stored procedure? I have 3 fields in my table called LockedBy (char 64), LockedByID (int 10) and LockedByDateTime (smalldatetime). When I perform a record lock I'd like to update those fields in the table so that any other calling procedure can see who has locked the record and when.
>>
>>Obviously, within my SQL stored procedure I'd need to pass in the LockedBy and LockedByID values, attempt a record lock, update the 3 fields, then finally I'd remove the record lock. The reason I don't want to let SQL continue to lock the record is because the user may have the record open for 60 minutes, so by using these 3 fields I can check if a record has been locked just by interrogating those fields. Once the user has finished with the record I would just do a reverse of the process.
>>
>>What's the best way to go about this?
>>
>>Regards
>
>There is no record locking in SQL Server as in VFP. You can use query hints in order to achieve some locking, but I don't think it's a recommended approach.

So what is the recommended approach ?
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform