When working with flat files, some files would need some fillers. I created this SQL function that will capture the character value, desired length, filler character, and the justification.
CREATE FUNCTION fn_fix_length_filler(
@TEXT NVARCHAR(4000),
@TOT_LENGTH BIGINT,
@FILLER NVARCH...
[More]