How is the SUBSTR keyword used in SQL ?

 Posted by Bharathi Cherukuri on 4/30/2012 | Category: Sql Server Interview questions | Views: 2106 | Points: 40
Answer:

SUBSTR is used for string manipulation with column name, first position and string length used as arguments.

Example:

SELECT LastName, SUBSTRING(FirstName, 1, 1) AS Initial

FROM Person.Contact
WHERE LastName like 'Barl%'
ORDER BY LastName

Result:

LastName Initial
--------------------------------- -------
Barley R
Barlow B

(2 row(s) affected)


Asked In: Many Interviews | Alert Moderator 

Comments or Responses

Login to post response