LEFT (Transact-SQL)
SQL Server 2012
Returns the left part of a character string with the specified number of characters.
When using SC collations, the integer_expression parameter counts a UTF-16 surrogate pair as one character. For more information, see Collation and Unicode Support.
A. Using LEFT with a column
The following example returns the five leftmost characters of each product name.
USE AdventureWorks2012; GO SELECT LEFT(Name, 5) FROM Production.Product ORDER BY ProductID; GO
B. Using LEFT with a character string
The following example uses LEFT to return the two leftmost characters of the character string abcdefg.
SELECT LEFT('abcdefg',2)
GO
Here is the result set.
-- ab (1 row(s) affected)