Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Get next number from SQL Server
Message
De
20/11/2006 13:16:04
Jerry Tovar
Dana Corporation Dana It
Maumee, Ohio, États-Unis
 
 
Information générale
Forum:
ASP.NET
Catégorie:
Code, syntaxe and commandes
Divers
Thread ID:
01171148
Message ID:
01171233
Vues:
7
David,

Using the UPDATE, would it be possible to have two or more users hit the routine at the same time and receive the same value? In VFP we would RLOCK the record to avoid this situation.

However, the identity column solution does sound like the better way to go.

Thanks,

Jerry



>Jerry,
>
>I'd recommend that you use an identity column if at all possible. If you can't you can accomplish what you want in an update:
>
>
>UPDATE KeyTable
>   SET @ReturnKey = LastKey = LastKey + 1
>   WHERE ...
>select @ReturnKey -- return to caller
>
>
>>Thanks, good point. Yes, I can make the order number field in the order header table an autoincrement. I was trying to duplicate what we currently do with VFP without an autoincrement, but you make a good point.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform