Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Record locking within an SQL stored procedure
Message
De
29/12/2005 16:07:49
 
 
À
29/12/2005 14:16:06
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Versions des environnements
Visual FoxPro:
VFP 9
OS:
Windows XP SP2
Network:
Windows 2000 Server
Database:
MS SQL Server
Divers
Thread ID:
01081764
Message ID:
01081843
Vues:
7
>Hi
>
>I'd like to be able to perform record locking, row update, within SQL2000. Basically, I'm trying to do the following:
>
>1. Select the correct record
>2. Attempt to lock record
>3. If able to lock, update a field within that record, release lock
>4. If not able to lock, attempt to lock for a specified amount of time.
>
>Here are some questions:
>
>1. If I attempt to lock the record with the select, what happens if the record is already locked or I'm unable to complete the lock? i.e. I'd want to be able to return a code to the calling program why the SQL procedure couldn't lock the record.
>
>Basically, it's as simple as that but it I've found it hard work reading the on-line SQL help files. The record locking MUST be completed by SQL server as the procedure will be called from VFP, VB and various other technologies.

Most back-end DBs such as SQL Server don't natively have this Fox-style concept of row/record "locking", you typically need to implement flags on tables, or a separate table to hold "current locks". For a discussion see the thread <B>How to lock records in SQL Server</B> Thread #772304 Message #772304
Regards. Al

"Violence is the last refuge of the incompetent." -- Isaac Asimov
"Never let your sense of morals prevent you from doing what is right." -- Isaac Asimov

Neither a despot, nor a doormat, be

Every app wants to be a database app when it grows up
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform