Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Help Getting first character from a name

Status
Not open for further replies.

thermolaney

IS-IT--Management
Mar 4, 2005
8
US
I have a field with the first names I want to strip off all but the first letter (First initial) and then combine it with the last name for a username. How do I strip off the dta I do not want?
 
Highly dependant of your RDBMS.
Either Left(FirstName,1) or substr(FirstName,1,1) or FirstName[1,1] or ...
The ANSI concatenation operator is ||

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Use the ANSI SQL function SUBSTRING:

SELECT SUBSTRING(firstname FROM 1 FOR 1) ||
' ' ||
lastname
FROM tablename
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top