Microsoft SQL Server Left


Returns a sub string starting with the left most char of a string and up to the maximum length specified.


  1. character expression. The character expression can be of any data type that can be implicitly converted to varchar or nvarchar, except for text or ntext
  2. max length. An integer number between 0 and bigint max value (9,223,372,036,854,775,807).
    If the max length parameter is negative, an error will be raised.
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'