Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Duplicate PK nos. allocated
Message
From
30/09/2006 07:56:31
Alan Harris-Reid
Baseline Data Services
Devon, United Kingdom
 
 
To
29/09/2006 16:52:02
General information
Forum:
Visual FoxPro
Category:
Client/server
Miscellaneous
Thread ID:
01156783
Message ID:
01158366
Views:
24
Hello Fabio,

>How long do the new 4000 ids require?

Fast, but doesn't have to be 'lightning' fast. A very small delay before the update should be ok. I tried your modified code and still SQL-server crashes.

However, there is good news. If I modify the loop code to get the connection handle once only before the loop starts (instead of within the NewId function for each new id), I can add 100000 new records with no problem! Looks like there is a VFP and/or SQL problem with opening and closing a handle so many times in quick succession.

I think I have cracked the problem now - many thanks for your help.

Alan


>
>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
Reply
Map
View

Click here to load this message in the networking platform