Thread: convert result to uppercase

convert result to uppercase

From
Victor Spång Arthursson
Date:
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

Re: convert result to uppercase

From
Janning Vygen
Date:
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


Re: convert result to uppercase

From
"Lee Harr"
Date:
>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


Re: convert result to uppercase

From
Bruno Wolff III
Date:
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)

Re: convert result to uppercase

From
Mark Gibson
Date:
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.


Re: convert result to uppercase

From
Andrew Kelly
Date:
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