SQL simple -> Simple uses of String functions MID() and UCase()



Here is example that demonstrates simple use of two important of string functions in Jet SQL: MID() and UCase(). In this example we will construct employee name from first and last names converting begining character of each name to Upper case:

SELECT e.EmpNo,
  Trim(UCase(Mid(e.FirstName,1,1))) + Trim(Mid(e.FirstName,2))
  + ' ' +
  Trim(UCase(Mid(e.LastName,1,1))) + Trim(Mid(e.LastName,2)) AS EmpName
FROM Employees AS e


The query returns results like these:
EmpNoEmpName
1John Silver
2Gret Garbo
3Le Chen
4Daniel Defo
5Maggi Forth


sqlexamples.info