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