Hi
There are still some issues with this syntax.
When the input value is 90.00
The output value is 0000009000 which is of 10 characters and not 11 which I want. There should be an 0 in addition to the 6 zeros that we have. The final output value should be 00000009000 (Total Length of 11)
When the input is 900.00
The output value is a Perfect which is 00000090000 (Total 11 Characters)
When the input value is 9000.00
The output value is 00000090000 which is wrong as 9000.00 will have to be represented as 900000 and there will be 5 zeros in front of it meaning 00000900000 (Total length of 11)
Any Views
Thanks
Gautam S
Quote:
Originally posted by dmmac
Amendment to my below post (ignore last post). With a little bit more refinement this is what you want:
SELECT
CONCAT(REPEAT('0',11-LENGTH(CAST(CAST((c1*100) as INTEGER) as char(5)))),CAST(CAST((c1*100) as integer) as char(5)))
FROM xxx WHERE .....
|