ewang1205
asked on
Round a 6 digit number
I like to have a sql to round a 6 digit number like the following. The length will alway to 6 digit and I like replace the last none 0 digit with 0. For example:
122000 to become 120000
120000 to become 100000
133400 to become 133000
133900 to become 133000
122000 to become 120000
120000 to become 100000
133400 to become 133000
133900 to become 133000
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
@schwertner: that method will not work if the first 0 is in a significant position. For example, use 103900.
Thats right! Thanks for the remark.
But the method can be fixed, because INSTR fuction can also
work from right to left.
But the method can be fixed, because INSTR fuction can also
work from right to left.
The best way to solve the problem is to write a function.
Functions could be called from SQL statements.
Functions could be called from SQL statements.
ASKER
Thanks for the help.