SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 Old Forums
 CLOSED - General SQL Server
 initcap
 Forum Locked
 Printer Friendly
Author Previous Topic Topic Next Topic  

ravilobo
Flowing Fount of Yak Knowledge

India
1183 Posts

Posted - 03/16/2005 :  08:43:21  Show Profile
In oracle..
select initcap('abcd') from dual;
returns
Abcd

Do we have a similar function in SQL2K? How to achieve this...



------------------------
I think, therefore I am

spirit1
Cybernetic Yak Master

Slovenia
11741 Posts

Posted - 03/16/2005 :  08:46:20  Show Profile  Visit spirit1's Homepage
no you must do
select upper(left(colName, 1)) + substring(colName, 2, len(colName)) as colName

Go with the flow & have fun! Else fight the flow
Go to Top of Page

ravilobo
Flowing Fount of Yak Knowledge

India
1183 Posts

Posted - 03/16/2005 :  08:51:46  Show Profile
OK.
Thanks for the code. As long as there is way to do it..its OK with me. Had seen the same function in foxpro...that is long back....

------------------------
I think, therefore I am
Go to Top of Page

spirit1
Cybernetic Yak Master

Slovenia
11741 Posts

Posted - 03/16/2005 :  08:53:56  Show Profile  Visit spirit1's Homepage
way long back...

Go with the flow & have fun! Else fight the flow
Go to Top of Page

ravilobo
Flowing Fount of Yak Knowledge

India
1183 Posts

Posted - 03/16/2005 :  08:57:13  Show Profile
Yep. ...loved foxpro..sort of created a big wave...that time.

------------------------
I think, therefore I am
Go to Top of Page

spirit1
Cybernetic Yak Master

Slovenia
11741 Posts

Posted - 03/16/2005 :  09:03:57  Show Profile  Visit spirit1's Homepage
i didn't. worked with it in 96... one of the first incarnations...
left it alone from then on

Go with the flow & have fun! Else fight the flow
Go to Top of Page

Kristen
Test

United Kingdom
22191 Posts

Posted - 03/16/2005 :  09:24:34  Show Profile
Do you just want a single initial CAP? Or Were You Looking For Title Caps?

Kristen
Go to Top of Page

ravilobo
Flowing Fount of Yak Knowledge

India
1183 Posts

Posted - 03/16/2005 :  09:41:38  Show Profile
Just want a single initial cap....but would love to see a code which is doing title caps...

------------------------
I think, therefore I am
Go to Top of Page

Kristen
Test

United Kingdom
22191 Posts

Posted - 03/16/2005 :  10:43:10  Show Profile
Several examples on SQL Team ... which saves me a job!

Kristen
Go to Top of Page

TG
Flowing Fount of Yak Knowledge

USA
5467 Posts

Posted - 03/16/2005 :  10:51:28  Show Profile
You Tease!

Be One with the Optimizer
TG
Go to Top of Page

Kristen
Test

United Kingdom
22191 Posts

Posted - 03/16/2005 :  11:10:16  Show Profile
"Several examples on SQL Team" is always a safe bet around these parts. If I'm wrong we'll just have to set it up as a Challenge!

Kristen
Go to Top of Page

sql_cable_guy
Starting Member

1 Posts

Posted - 05/09/2005 :  07:54:48  Show Profile  Visit sql_cable_guy's Homepage
hmm Title caps.. Have to think about that one
A previous response
select upper(left(colName, 1)) + substring(colName, 2, len(colName)) as colName
works with 'abcd'

This works with 'ABCD' or 'abcd' to give you initcap.

select upper(left(lower(colName), 1)) + substring(lower(colName), 2, len(colName)) as colName
Go to Top of Page
  Previous Topic Topic Next Topic  
 Forum Locked
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.08 seconds. Powered By: Snitz Forums 2000