Returns part of a character, binary, text, or image expression.
Returns character data if expressionis one of the supported character data types. Returns binary data if expressionis one of the supported binary data types. If start = 1, then the substring begins from the first character of the expression.
The returned string is the same type as the given expression with the exceptions shown in the following table.
The following example returns the initial of the first name and the full last name for each employee in the Employees table.
SELECT SUBSTRING([First Name],1,1) AS Initial, [Last Name] FROM Employees
This is the result set:
Initial Last Name ---------------------------- N Davolio A Fuller J Leverling M Peacock S Buchanan M Suyama R King L Callahan A Dodsworth A Hellstern T Smith C Patterson J Brid X Martin L Pereira (15 rows affected)