Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Get next number from SQL Server
Message
From
20/11/2006 13:16:04
Jerry Tovar
Dana Corporation Dana It
Maumee, Ohio, United States
 
General information
Forum:
ASP.NET
Category:
Coding, syntax and commands
Miscellaneous
Thread ID:
01171148
Message ID:
01171233
Views:
6
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.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform