Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
SQL Return Code retrieval with SQLEXEC
Message
 
 
À
07/09/2005 04:14:43
Rodney Eales
Black Seas Information Technologies
Johannesburg, Afrique du Sud
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Divers
Thread ID:
01047272
Message ID:
01047374
Vues:
8
Rodney,

You realize that the SP can return incorrect values to the caller? Someone else can have updated the value between the time the update and the select runs.

Using code like this will increment the value and return it without the possibility of conflict.
update Entities
set
  @DblSpare1 = DblSpare1 = IsNull(DblSpare1, 0) + 1

return @DblSpare1
>The stored proc is as follows:
>
>create procedure [dbo]._bspNextAuditNo
>with encryption
>as
>
>set nocount on
>
>update Entities
>set
> DblSpare1 = IsNull(DblSpare1, 0) + 1
>
>declare @NextAuditNo int
>set @NextAuditNo = (select top 1 DblSpare1 from Entities)
>return @NextAuditNo
df (was a 10 time MVP)

df FoxPro website
FoxPro Wiki site online, editable knowledgebase
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform