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 Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Initial Capitals (how to insert to db)

Status
Not open for further replies.

gtbikerider

Technical User
May 22, 2001
81
GB
Hi

I'm using...

<CFQUERY NAME=&quot;AddRec&quot; DATASOURCE=&quot;#application.DSN#&quot;>
insert into Users (FirstName)
values ('#FORM.firstname#')
</CFQUERY>

...to add a value to a db. How would I force an initial capital letter? eg &quot;john&quot; becomes &quot;John&quot;. I think its InitCap in sql but I can't figure out the precise syntax.

--
John Carratt
 
RedLeaf:

I could never figure out how to use INITCAP in a CF INSERT operation, either. You could use CF's UCASE function as follows:

<cfset namelen=LEN(form.firstname)>
<cfset fname = '#UCASE(Left(form.firstname, 1))##LCASE(MID(form.firstname, 2, namelen-1))#'>

Then insert fname into your table.

John Hoarty
jhoarty@quickestore.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top