00000mmyy (1 Viewer)

Shoaib136

New member
Local time
Today, 15:35
Joined
Feb 1, 2020
Messages
4
Dear I need to generate an auto number where last 4 digits should be "mmyy" i.e. Month and year two digits. And the next digits should be automatically restart from 1, once the year changes.
 

theDBguy

I’m here to help
Staff member
Local time
Today, 03:35
Joined
Oct 29, 2018
Messages
11,892
Hi. Welcome to AWF! You might want to ask your question in one of the regular forums. There are plenty of solutions available to this particular issue.
 

pbaldy

Wino Moderator
Staff member
Local time
Today, 03:35
Joined
Aug 30, 2003
Messages
34,527
Welcome. I moved your thread to a more appropriate forum.
 

Pat Hartman

Super Moderator
Staff member
Local time
Today, 06:35
Joined
Feb 19, 2002
Messages
29,479
If you are going to mush the date with the sequence number, you MUST put the fixed part of the string on the left so it must be yymm00000 or mmyy000000 so you can always strip off the first four characters to isolate the sequence number on which you need to do arithmetic. Since you want to reset on the year, I would start with year rather than month.
 

Cronk

Registered User.
Local time
Today, 20:35
Joined
Jul 4, 2013
Messages
2,416
Alternatively, it might be easier to pre-populate the table with all the combinations of month and year over the time period expected to ever be held in the database.
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Top Bottom