I have a table that use to use 4 digits as part of the invoice. I've since did 9999 invoices and tried to change it to 99999. my invoice number is in format XXX-MM-9999
when change the max value in the database to 09999 to the select statement would get the max invnum then add 1 to it. Instead it would return the lowest negative number eg. -1954 instead of 01955.
SELECT MAX(RIGHT(INVOICEID,5)) AS invnum from orders where ucase(left(invoiceUD,3))='AJM'; I would get -2276 as the result but the highest number is 02284, but the lowest negative is -2276. I know it has the negative but should Max choose the Max Positive number? If I manually convert all the 4digit invnum to 5 digits it work fine.
is there something wrong with my sql statement? I tried to do where invum>0 but got error wrong datatype
when change the max value in the database to 09999 to the select statement would get the max invnum then add 1 to it. Instead it would return the lowest negative number eg. -1954 instead of 01955.
SELECT MAX(RIGHT(INVOICEID,5)) AS invnum from orders where ucase(left(invoiceUD,3))='AJM'; I would get -2276 as the result but the highest number is 02284, but the lowest negative is -2276. I know it has the negative but should Max choose the Max Positive number? If I manually convert all the 4digit invnum to 5 digits it work fine.
is there something wrong with my sql statement? I tried to do where invum>0 but got error wrong datatype