Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
swissivan
Starting Member
30 Posts |
Posted - 2013-02-05 : 23:36:22
|
A table is used for storing current number of Sales OrderCurrentNumber| name | prefix | current_number || SalesOrder | SO | 10 |I got multiple users to access this row to get the latest numberINSERT INTO SalesOrder (id,field2,...) SELECT (prefix + RIGHT('000' + CAST(current_number AS VARCHAR(4)), 4)), value2,... FROM CurrentNumberThen update the current_number to 11How to add locking on this row to prevent two users create sales order with same number? Thanks for any comments. |
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
|
|
|
|