my auto number has 2 parts
3 digits serial number , last 8 digits month , year of invoice
for example: 001072013
so if want next invoiceno
i select last entry of invoice number database
select top 1 invoiceno buyinvoice cut first 3 digits, , make increment, , combine month , year of invoice
so 002072013
the problem above statement doesn't return last entry value
and ascending , descending both don't work
i try:
select top 1 invoiceno buyinvoice order right(invoiceno,4) desc, right(invoiceno, 6) desc, invoiceno desc
Comments
Post a Comment