Need to add leading zeros to column values(varchar) and update it in same table. ex: 431 as 000431, 5431 as 005431, 64531 as 064531, basically i need to substitute zeros to the data so that it is 6 digits. this is in sybase ase.
thanks
If you can't use LPAD()
, and the source number is an integer
, this solution is maybe a little nicer than yours:
RIGHT(1000000+Number, 6)
But, as yours, it produces unexpected results if the value is negative or has more than 6 digits.