Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Duplicate PK nos. allocated
Message
From
29/09/2006 16:52:02
 
 
To
29/09/2006 15:46:38
Alan Harris-Reid
Baseline Data Services
Devon, United Kingdom
General information
Forum:
Visual FoxPro
Category:
Client/server
Miscellaneous
Thread ID:
01156783
Message ID:
01158287
Views:
34
>Hello Fabio,
>
>>you want to complicate the simple things.
>
>No I don't - honest! Always grateful for ideas to make my work easier, but at the same time I need to understand what is going on. Incidentally, why the line SET LOCK_TIMEOUT 5000?

If another user lock the same record, sql wait for 5s before raise a error.

>
>>If you don't check the return value of SQLEXEC() the program cannot work to along.
>
>I used the code you supplied, and it works fine until it has created around 4000 new id values, then SQL-server crashes with the messages I mentioned previously.
>

How long do the new 4000 ids require?

try this:
....
TEXT TO lcSQLCmd TEXTMERGE NOSHOW 
	DECLARE @newId INT

        SET NOCOUNT ON
        SET LOCK_TIMEOUT 1000

-- OPTIONAL
--      WAITFOR DELAY '0:0.05'
   	UPDATE UniqueId
		 SET @newId= nLastNumber = nLastNumber+1 
		 WHERE UPPER(cFieldName) = '<<lcFieldName>>'

	SELECT @newId AS nNewNumber
ENDTEXT
...
>Regards,
>Alan
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform