Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 Old Forums
 CLOSED - General SQL Server
 initcap

Author  Topic 

ravilobo
Master Smack Fu Yak Hacker

1184 Posts

Posted - 2005-03-16 : 08:43:21
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

11752 Posts

Posted - 2005-03-16 : 08:46:20
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
Master Smack Fu Yak Hacker

1184 Posts

Posted - 2005-03-16 : 08:51:46
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

11752 Posts

Posted - 2005-03-16 : 08:53:56
way long back...

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

ravilobo
Master Smack Fu Yak Hacker

1184 Posts

Posted - 2005-03-16 : 08:57:13
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

11752 Posts

Posted - 2005-03-16 : 09:03:57
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

22859 Posts

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

Kristen
Go to Top of Page

ravilobo
Master Smack Fu Yak Hacker

1184 Posts

Posted - 2005-03-16 : 09:41:38
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

22859 Posts

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

Kristen
Go to Top of Page

TG
Master Smack Fu Yak Hacker

6065 Posts

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

Be One with the Optimizer
TG
Go to Top of Page

Kristen
Test

22859 Posts

Posted - 2005-03-16 : 11:10:16
"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 Post

Posted - 2005-05-09 : 07:54:48
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
   

- Advertisement -