I have a field called order_no to keep track the order number. Previously set order_no to varchar in database. In order to get new order_no when creating new order, i do a select max(order_no)+1 from ocf table;
Problem now is the order_no reach 10000, and when i do a select max(order_no) from ocf; the query result 9999.
I do an update ocf set order_no=10001 where order_no=9999;
THEN do a select max(order_no) again, it return 9998 (10001 < 9998 ????!!!)
I know the max() is to work for Int only, but without changing the field type from varchar to integer, any solution for this?
Appreciate it very much. THANKS!
|