Left Example 1:
SELECT LEFT ('abcdefghik',3);
Result: abc
SELECT LEFT ('12345',2);
Result: 12
SELECT LEFT (17345,2);
Result: 17
SELECT LEFT ('1a2b3c',4);
Result: 1a2b
Left Example 2:
Cities table:
CITY_ID | NAME | STATE |
---|---|---|
1 | New York | New York |
2 | Los Angeles | California |
3 | Chicago | Illinois |
4 | San Antonio | Texas |
5 | San Diego | California |
SELECT LEFT (name, 3) AS Result
FROM cities
WHERE state='California';
Left Result:
Result |
---|
Los |
San |
See also: T-SQL Functions -> Right | LTRIM | RTRIM