473,398 Members | 2,427 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,398 software developers and data experts.

Records Counter

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)
Nov 20 '05 #1
1 1035
Hi Dino,

Maybe this answer is to simple, however I would make a table in my database
with two field,
Years and lastnumber. Now that is two rows.

I hope this helps?
Cor
Nov 20 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Charles Ranch | last post by:
Hello, I'll bet this is an elementary question. I have a text file I am converting and posting to a SQL database. But the first 15 records in this text file are going into a NOTES field in the...
10
by: D. Dante Lorenso | last post by:
I'd like to run a clean up command on my tables to eliminate rows that I'm no longer using in the database. I want to do something like this: DELETE FROM tablename WHERE...
6
by: Matt K. | last post by:
Hi there, I have a form in an Access project that contains a subform which displays the results of a query of the style "select * from where = #a certain date#". In the main part of the form...
1
by: kgatchell2001 | last post by:
Hello, I am using Access 2002 to track payroll. I am trying to carry a person's Sick time accrued into the next record for an individual. I am a beginner with access. I am using the following...
1
by: Giulio Simeone | last post by:
Hello, I am using Windows 98 and Access XP and I have noticed the following strange thing. When I add a new record to a table, sometimes the counter is correctly set to the highest counter in the...
2
by: Brian Ciarcia | last post by:
Can someone please take a look at this code and tell me what I am doing wrong??? I am getting the following error: ---------------------------------------------------- Object reference not...
6
by: Christo | last post by:
I have this script for showing news on a page, but i want it to only show the last 10 records, as in the 10 records that were added to the database last. the script shows the entries in descending...
10
by: minapatel | last post by:
Hi, I am trying to purge cases using an sql cursor:- cursor all_cases is cursor all_cases is select c.id00_warehouse, c.id00_case_nbr, c.id00_status_flag, c.id00_dlm from phpick00...
7
by: Pim75 | last post by:
Hello, I want to store multiple records at once in a SQL database with a For..Next instruction like the sample code below: For counter = 0 To 100 Dim dbInsert As New SqlCommand( _ "INSERT...
4
by: rishhh | last post by:
The following query results no records. I am trying to exlude the Counter party Descriptions present in the Adjustments table, from the results of the main query. Any help is appreciated. SELECT...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.