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
I would do it like this.
SELECT RIGHT(REPLICATE('0', 5) + CAST(Field2 AS VARCHAR(5),5)
Not necessarily all that "Easier", or more efficient, but better to read. Could be optimized to remove the need for "RIGHT"