convert result to uppercase

Started by Victor Spång Arthurssonalmost 22 years ago6 messagesgeneral
Jump to latest
#1Victor Spång Arthursson
scooterbabe@home.se

Hi!

How do i convert a result to upper/lowercase?

I'ld like to do the following:

SELECT UPPER(lang) from languages;

and get for example "uk" as "UK", "dk" AS "DK" and so on…

Sincerely

Victor

#2Mark Gibson
gibsonm@cromwell.co.uk
In reply to: Victor Spång Arthursson (#1)
Re: convert result to uppercase

Victor Sp�ng Arthursson wrote:

How do i convert a result to upper/lowercase?

I'ld like to do the following:

SELECT UPPER(lang) from languages;

and get for example "uk" as "UK", "dk" AS "DK" and so on�

You can do exactly that, upper() and lower() functions exist:
http://www.postgresql.org/docs/7.4/interactive/functions-string.html

--
Mark Gibson <gibsonm |AT| cromwell |DOT| co |DOT| uk>
Web Developer & Database Admin
Cromwell Tools Ltd.
Leicester, England.

#3Bruno Wolff III
bruno@wolff.to
In reply to: Victor Spång Arthursson (#1)
Re: convert result to uppercase

On Tue, Apr 13, 2004 at 14:17:27 +0200,
Victor Sp�ng Arthursson <scooterbabe@home.se> wrote:

Hi!

How do i convert a result to upper/lowercase?

I'ld like to do the following:

SELECT UPPER(lang) from languages;

That's what you do. For example:
bruno=> select upper('test');
upper
-------
TEST
(1 row)

#4Lee Harr
missive@hotmail.com
In reply to: Bruno Wolff III (#3)
Re: convert result to uppercase

How do i convert a result to upper/lowercase?

I'ld like to do the following:

SELECT UPPER(lang) from languages;

and get for example "uk" as "UK", "dk" AS "DK" and so on?

That looks right to me. Are you getting an error?

lee=# select version();
version
---------------------------------------------------------------------
PostgreSQL 7.4.2 on i386-portbld-freebsd4.9, compiled by GCC 2.95.4
(1 row)

lee=# select UPPER('MixED CaSes');
upper
-------------
MIXED CASES
(1 row)

lee=# select lower('MixED CaSes');
lower
-------------
mixed cases
(1 row)

_________________________________________________________________
MSN 8 helps eliminate e-mail viruses. Get 2 months FREE*.
http://join.msn.com/?page=features/virus

#5Janning Vygen
vygen@gmx.de
In reply to: Victor Spång Arthursson (#1)
Re: convert result to uppercase

Am Dienstag, 13. April 2004 14:17 schrieb Victor Spång Arthursson:

Hi!

How do i convert a result to upper/lowercase?

This is a question

SELECT UPPER(lang) from languages;

and this is the answer. It works exactly like this:

SELECT UPPER('dk');

results in 'DK'

kind regards,
Janning

#6Andrew Kelly
akelly@transparency.org
In reply to: Janning Vygen (#5)
Re: convert result to uppercase

On Tue, 2004-04-20 at 23:39, Janning Vygen wrote:

Am Dienstag, 13. April 2004 14:17 schrieb Victor Sp�ng Arthursson:

Hi!

How do i convert a result to upper/lowercase?

This is a question

SELECT UPPER(lang) from languages;

and this is the answer. It works exactly like this:

SELECT UPPER('dk');

results in 'DK'

kind regards,
Janning

Aren't we now back to the recent thread about UTF-8 and case conversion?
How do you make UPPER and LOWER work on a multi-byte encoded stuff?
How do you get a properly alphabetized return set that, for example,
contains English, German, French, Spanish, Russian and Turkish records?

Andy