The LPAD, RPAD, REPLACE or CONCAT function returned a string whose length is outside the range from 1 to 255 bytes for NVARCHAR or VARCHAR, or from 1 to 32739 bytes for CHAR, NCHAR, or LVARCHAR. These functions return a string whose data type depends on the data type of the input string that the function is formatting. Make sure that the function returns a string whose length is within the size range for the returned data type.