pg.ddx.io pgsql-sql@postgresql.org mailing list archive
help / color / mirror / Atom feedUpdate value to "the first character is capital and the rest is small"
5+ messages / 3 participants
[nested] [flat]
* Update value to "the first character is capital and the rest is small"
@ 2006-03-13 22:31 Emi Lu <emilu@encs.concordia.ca>
2006-03-13 22:36 ` Re: [SQL] Update value to "the first character is capital and the rest is small" Alvaro Herrera <alvherre@commandprompt.com>
2006-03-13 22:37 ` Re: Update value to "the first character is capital and Emi Lu <emilu@encs.concordia.ca>
2006-03-14 07:56 ` Re: Update value to "the first character is capital and John Sidney-Woollett <johnsw@wardbrook.com>
0 siblings, 3 replies; 5+ messages in thread
From: Emi Lu @ 2006-03-13 22:31 UTC (permalink / raw)
To: pgsql-general@postgresql.org; pgsql-sql
Hello all,
Does anyone have available plpgsql codes to update all capital letters
in a column to "the first character is capital and the rest is small" ?
For example, in tableA(id, description)
001, 'ZHANG ZHE XIN' =>
'Zhang Zhe Xin'
002, 'LIU, WEI-HUAI'
=> 'Liu, Wei-Huai'
003, 'GU & WEI. NAN (CE SHI) & TOMMORROW' => 'Gu & Wei. Nan (Ce
Shi) & Tommorrow'
Thanks a lot!
Ying
^ permalink raw reply [nested|flat] 5+ messages in thread
* Re: [SQL] Update value to "the first character is capital and the rest is small"
2006-03-13 22:31 Update value to "the first character is capital and the rest is small" Emi Lu <emilu@encs.concordia.ca>
@ 2006-03-13 22:36 ` Alvaro Herrera <alvherre@commandprompt.com>
2006-03-13 22:55 ` Re: [GENERAL] Update value to "the first character is capital Emi Lu <emilu@encs.concordia.ca>
2 siblings, 1 reply; 5+ messages in thread
From: Alvaro Herrera @ 2006-03-13 22:36 UTC (permalink / raw)
To: Emi Lu <emilu@encs.concordia.ca>; +Cc: pgsql-general@postgresql.org; pgsql-sql
Emi Lu wrote:
> Hello all,
>
> Does anyone have available plpgsql codes to update all capital letters
> in a column to "the first character is capital and the rest is small" ?
I don't know about plpgsql codes, but there is a function initcap() that
you can use for that.
alvherre=# select initcap('GU & WEI. NAN (CE SHI) & TOMMORROW');
initcap
------------------------------------
Gu & Wei. Nan (Ce Shi) & Tommorrow
(1 row)
--
Alvaro Herrera http://www.CommandPrompt.com/
PostgreSQL Replication, Consulting, Custom Development, 24x7 support
^ permalink raw reply [nested|flat] 5+ messages in thread
* Re: [GENERAL] Update value to "the first character is capital
2006-03-13 22:31 Update value to "the first character is capital and the rest is small" Emi Lu <emilu@encs.concordia.ca>
2006-03-13 22:36 ` Re: [SQL] Update value to "the first character is capital and the rest is small" Alvaro Herrera <alvherre@commandprompt.com>
@ 2006-03-13 22:55 ` Emi Lu <emilu@encs.concordia.ca>
0 siblings, 0 replies; 5+ messages in thread
From: Emi Lu @ 2006-03-13 22:55 UTC (permalink / raw)
To: Alvaro Herrera <alvherre@commandprompt.com>; +Cc: pgsql-sql
I saw it from the docs as well. Thank you Alvaro :)
Alvaro Herrera wrote:
>Emi Lu wrote:
>
>
>>Hello all,
>>
>>Does anyone have available plpgsql codes to update all capital letters
>>in a column to "the first character is capital and the rest is small" ?
>>
>>
>
>I don't know about plpgsql codes, but there is a function initcap() that
>you can use for that.
>
>alvherre=# select initcap('GU & WEI. NAN (CE SHI) & TOMMORROW');
> initcap
>------------------------------------
> Gu & Wei. Nan (Ce Shi) & Tommorrow
>(1 row)
>
>
>
^ permalink raw reply [nested|flat] 5+ messages in thread
* Re: Update value to "the first character is capital and
2006-03-13 22:31 Update value to "the first character is capital and the rest is small" Emi Lu <emilu@encs.concordia.ca>
@ 2006-03-13 22:37 ` Emi Lu <emilu@encs.concordia.ca>
2 siblings, 0 replies; 5+ messages in thread
From: Emi Lu @ 2006-03-13 22:37 UTC (permalink / raw)
To: emilu@encs.concordia.ca; +Cc: pgsql-general@postgresql.org; pgsql-sql
I got the answer from the docs. |initcap|(text)
thanks anyway,
Ying
> Hello all,
>
> Does anyone have available plpgsql codes to update all capital letters
> in a column to "the first character is capital and the rest is small" ?
>
> For example, in tableA(id, description)
> 001, 'ZHANG ZHE XIN'
> => 'Zhang Zhe Xin'
> 002, 'LIU, WEI-HUAI'
> => 'Liu, Wei-Huai'
> 003, 'GU & WEI. NAN (CE SHI) & TOMMORROW' => 'Gu & Wei. Nan
> (Ce Shi) & Tommorrow'
>
> Thanks a lot!
> Ying
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 5: don't forget to increase your free space map settings
^ permalink raw reply [nested|flat] 5+ messages in thread
* Re: Update value to "the first character is capital and
2006-03-13 22:31 Update value to "the first character is capital and the rest is small" Emi Lu <emilu@encs.concordia.ca>
@ 2006-03-14 07:56 ` John Sidney-Woollett <johnsw@wardbrook.com>
2 siblings, 0 replies; 5+ messages in thread
From: John Sidney-Woollett @ 2006-03-14 07:56 UTC (permalink / raw)
To: emilu@encs.concordia.ca; +Cc: pgsql-general@postgresql.org
Have you tried the initcap function?
select initcap('abcd efgh');
initcap
-----------
Abcd Efgh
John
Emi Lu wrote:
> Hello all,
>
> Does anyone have available plpgsql codes to update all capital letters
> in a column to "the first character is capital and the rest is small" ?
>
> For example, in tableA(id, description)
> 001, 'ZHANG ZHE XIN' =>
> 'Zhang Zhe Xin'
> 002, 'LIU, WEI-HUAI'
> => 'Liu, Wei-Huai'
> 003, 'GU & WEI. NAN (CE SHI) & TOMMORROW' => 'Gu & Wei. Nan (Ce
> Shi) & Tommorrow'
>
> Thanks a lot!
> Ying
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 5: don't forget to increase your free space map settings
^ permalink raw reply [nested|flat] 5+ messages in thread
end of thread, other threads:[~2006-03-14 07:56 UTC | newest]
Thread overview: 5+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2006-03-13 22:31 Update value to "the first character is capital and the rest is small" Emi Lu <emilu@encs.concordia.ca>
2006-03-13 22:36 ` Alvaro Herrera <alvherre@commandprompt.com>
2006-03-13 22:55 ` Re: [GENERAL] Update value to "the first character is capital Emi Lu <emilu@encs.concordia.ca>
2006-03-13 22:37 ` Re: Update value to "the first character is capital and Emi Lu <emilu@encs.concordia.ca>
2006-03-14 07:56 ` Re: Update value to "the first character is capital and John Sidney-Woollett <johnsw@wardbrook.com>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox