Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Duplicate PK nos. allocated
Message
From
27/09/2006 09:05:07
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
 
To
27/09/2006 08:21:07
Alan Harris-Reid
Baseline Data Services
Devon, United Kingdom
General information
Forum:
Visual FoxPro
Category:
Client/server
Miscellaneous
Thread ID:
01156783
Message ID:
01157458
Views:
20
>Hi Fabio, thanks for the reply.
>
>
>IF 1 # SQLEXEC(lnConnHandle, ;
>	 [;
>DECLARE @newId INT;
>UPDATE UniqueId SET @newId = nLastNumber = nLastNumber + 1 WHERE ]+m.lcFilter;
>+ [ SELECT @newId AS nNewNumber], 'UniqueIdV')
>  * ERROR
>ENDIF
>* nNewNumber
>
>
>That's neat! A couple of questions...
>
>a) SET @newId = nLastNumber = nLastNumber + 1. Is this the same as SET @NewId=nLastNumber+1,nLastNumber=@NewId (ie. SET both @newid and nLastNumber to nLastNumber+1)?
>
>b) The code is not explicitly locking the record before the upddate. Does the UPDATE command guarantee a lock on the record? (In other words, do I definitely NOT need to wrap the code in a transaction?)
>
>Regards,
>
>Alan

a) Yes
b) Update implicitly locks (actually any block of codes are implicitly contained in an automatic transaction).
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Previous
Reply
Map
View

Click here to load this message in the networking platform