Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Duplicate PK nos. allocated
Message
De
29/09/2006 16:52:02
 
 
À
29/09/2006 15:46:38
Alan Harris-Reid
Baseline Data Services
Devon, Royaume Uni
Information générale
Forum:
Visual FoxPro
Catégorie:
Client/serveur
Divers
Thread ID:
01156783
Message ID:
01158287
Vues:
35
>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
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform