Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Forcing RLOCK() in SQL Server
Message
From
20/11/2005 18:41:18
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Title:
Forcing RLOCK() in SQL Server
Miscellaneous
Thread ID:
01070653
Message ID:
01070653
Views:
56
Is there a way to force a record locking in SQL Server?

I have this code which is returning the next primary key on a specific table and I am trying to know if this code can be converted to achieve the same assuming I have the same data structure on SQL Server.
* Get the next id
* expC1 Name of the table in TABLE.DBF
FUNCTION GetNumero
PARAMETER tcTable
LOCAL lnOldSel,lnCompteur,lnNumero,lnLen,lcTable,lnOldRec
lnOldSel=SELECT()
lnCompteur=0
SELECT TABLE
lnOldRec=SaveRec()
lnLen=LEN(Table)
lcTable=PADR(tcTable,lnLen,' ')
SEEK UPPER(lcTable) ORDER TAG TABLE
DO WHILE (NOT RLOCK()) AND (INKEY(0.1)=0) AND lnCompteur<=25
   lnCompteur=lnCompteur+1
ENDDO
REPLACE ID WITH ID+1
UNLOCK
lnNumero=ID
RestRec(lnOldRec)
SELECT(lnOldSel)
RETURN lnNumero
Michel Fournier
Level Extreme Inc.
Designer, architect, owner of the Level Extreme Platform
Subscribe to the site at https://www.levelextreme.com/Home/DataEntry?Activator=55&NoStore=303
Subscription benefits https://www.levelextreme.com/Home/ViewPage?Activator=7&ID=52
Next
Reply
Map
View

Click here to load this message in the networking platform