Returns a sub string starting with the left most char of a string and up to the maximum length specified.
Parameters:
varchar
or nvarchar
, except for text
or ntext
bigint
max value (9,223,372,036,854,775,807).SELECT LEFT('This is my string', 4) -- result: 'This'
If the max length is more then the number of characters in the string, the entier string is returned.
SELECT LEFT('This is my string', 50) -- result: 'This is my string'