Can I add leading zeros to a column? Requirement arises from needs of a business user who wants to do sorting on a column.
Issue is - column is a character column but contains numeric data. So when user sorts, 693 comes after 5123. Character column will sort it based on first digit and so on.
Can't change data model as this is a legacy system. So a solution? Add leading zeros to data of this column. So, 693 will become 0693 and will appear before 5123.
Am loading using AWK. Can I check for column length in AWK? And if length is less then 5, add zeros to the data in do-while loop etc.
Please help.
Cheers,
Sachin
Issue is - column is a character column but contains numeric data. So when user sorts, 693 comes after 5123. Character column will sort it based on first digit and so on.
Can't change data model as this is a legacy system. So a solution? Add leading zeros to data of this column. So, 693 will become 0693 and will appear before 5123.
Am loading using AWK. Can I check for column length in AWK? And if length is less then 5, add zeros to the data in do-while loop etc.
Please help.
Cheers,
Sachin