00000mmyy (1 Viewer)

Shoaib136

New member
Local time
Today, 10:10
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
Yesterday, 22:10
Joined
Oct 29, 2018
Messages
21,358
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
Yesterday, 22:10
Joined
Aug 30, 2003
Messages
36,118
Welcome. I moved your thread to a more appropriate forum.
 

Pat Hartman

Super Moderator
Staff member
Local time
Today, 01:10
Joined
Feb 19, 2002
Messages
42,981
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, 16:10
Joined
Jul 4, 2013
Messages
2,770
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

Top Bottom