剩下

返回以字串最左邊的 char 開頭並且最多指定的最大長度的子字串。

引數:

  1. 人物表達。字元表示式可以是任何可以隱式轉換為 varcharnvarchar 的資料型別,但 textntext 除外
  2. 最長長度。0 到 bigint 最大值之間的整數(9,223,372,036,854,775,807)。
    如果 max length 引數為負,則會引發錯誤。
SELECT LEFT('This is my string', 4) -- result: 'This'

如果最大長度大於字串中的字元數,則返回 entier 字串。

SELECT LEFT('This is my string', 50) -- result: 'This is my string'