I need to return two fields from a database concatenated as \'field1-field2\'. The second field is an int, but needs to be returned as a fixed length of 5 with leading 0\'s. T
If you want to get a consistent number of total strings in the final result by adding different number of zeros, here is a little bit modification (for vsql)
SELECT
CONCAT(
REPEAT('0', 9-length(TO_CHAR(var1))),
CAST(var1 AS VARCHAR(9))
) as var1