Aaron Bertrand sorts out an error:
Msg 537, Level 16, State 3Invalid length parameter passed to the LEFT or SUBSTRING function. The invalid length error, as shown above, occurs when you have incorrect or unexpected input to a string function.
Read on for examples of how you can trigger this error and what you can do to prevent it.