Thread: convert result to uppercase
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
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
>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
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)
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.
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