I want to generate a reference number based on the following format:
ddddd/nnnnn
where ddddd is a unique number for the day, which is increased by 1 every day.
nnnnn is an incremented number for each item and is zeroed every morning
given the table:
CREATE TABLE [ReferenceNumberTable] (
[ReferenceNumber] [varchar] (11)
)
what is the best method of returning a new reference for each item (many items per day) and avoiding the possibility of deadlocks, or duplication?
Maybe a different ReferenceNumberTable structure would help
such as ?
CREATE TABLE [ReferenceNumberTable] (
[DailyReferenceNumber] [int],
[ItemReferenceNumber] [int]
)
so that
update ReferenceNumberTable
set ItemReferenceNumber = ItemReferenceNumber + 1
select ItemReferenceNumber from ReferenceNumberTable
and then bulk out the second part of the reference number to five characters after it has been returned to the calling program
???
Am I making a mole out of a moundhill?
John
ddddd/nnnnn
where ddddd is a unique number for the day, which is increased by 1 every day.
nnnnn is an incremented number for each item and is zeroed every morning
given the table:
CREATE TABLE [ReferenceNumberTable] (
[ReferenceNumber] [varchar] (11)
)
what is the best method of returning a new reference for each item (many items per day) and avoiding the possibility of deadlocks, or duplication?
Maybe a different ReferenceNumberTable structure would help
such as ?
CREATE TABLE [ReferenceNumberTable] (
[DailyReferenceNumber] [int],
[ItemReferenceNumber] [int]
)
so that
update ReferenceNumberTable
set ItemReferenceNumber = ItemReferenceNumber + 1
select ItemReferenceNumber from ReferenceNumberTable
and then bulk out the second part of the reference number to five characters after it has been returned to the calling program
???
Am I making a mole out of a moundhill?
John