D
Dino Buljubasic
Hi,
I have to generate a number representing ID of my record in format
like: 2004.00001 where 2004 is current year and 0000x is the number of
record added to my database (i.e. 1st record is 00001, 2nd record
00002, 3rd record 00003 etc)
However, when I move to year 2005, the counter should start again from
1 so the 1st record added in 2005 would be 2005.00001, 2nd record
added in 2005 would be 2005.00002 etc.
my question is how to generate these numbers and keep track of how
many I have so far in this year.
I was thinking to have a table in my database simply holding one
value, the number of record added in this year and simply reset it to
0 when I move to the next year, or incerement/decrement it while I am
still in this year. That way I can read that number and increment it
when I add next record.
Would this be a good approach or somebody has a better idea?
Thank you,
Dino
PS. I am using SQL Server and VB.NET (.net Framework 1.0)
I have to generate a number representing ID of my record in format
like: 2004.00001 where 2004 is current year and 0000x is the number of
record added to my database (i.e. 1st record is 00001, 2nd record
00002, 3rd record 00003 etc)
However, when I move to year 2005, the counter should start again from
1 so the 1st record added in 2005 would be 2005.00001, 2nd record
added in 2005 would be 2005.00002 etc.
my question is how to generate these numbers and keep track of how
many I have so far in this year.
I was thinking to have a table in my database simply holding one
value, the number of record added in this year and simply reset it to
0 when I move to the next year, or incerement/decrement it while I am
still in this year. That way I can read that number and increment it
when I add next record.
Would this be a good approach or somebody has a better idea?
Thank you,
Dino
PS. I am using SQL Server and VB.NET (.net Framework 1.0)