How to generate a transaction number?
Posted
by
001
on Stack Overflow
See other posts from Stack Overflow
or by 001
Published on 2010-12-09T15:45:49Z
Indexed on
2010/12/21
19:54 UTC
Read the original article
Hit count: 240
I was thinking of formatting it like this
TYYYYMMDDNNNNNNNNNNX (1 character + 19 digits)
Where
- T is type
- YYYY is year
- MM is month
- DD is day
- N is sequencial number
- X is check digit
The problem is, how do I generate the sequencial number? since my primary key is not an auto increment integer value, if it was i would use that, but its not.
EDIT can I have the sequencial number resets itself after 1 day (24hours).
- P201012080000000001X <-- first transaction of 2010/12/08
- P2010120810000000002X <--- second transaction of 2010/12/08
- P201012090000000001X <--- First transaction of 2010/12/09
(X is the check digit)
© Stack Overflow or respective owner