From: | "Josh Berkus" <josh(at)agliodbs(dot)com> |
---|---|
To: | "Fredrik Thunberg" <fredrik(at)datessa(dot)se>, <pgsql-novice(at)postgresql(dot)org> |
Subject: | Re: Concatenating strings |
Date: | 2001-10-23 16:51:17 |
Message-ID: | web-490614@davinci.ethosmedia.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-novice |
Frederick,
> How do you add two strings in sql?
You use the ANSI SQL 92 standard concatination operator, ||
e.g. first_name || ' ' || last_name
> I have a name field in one of my tables and all the names are in
> uppercase
> (like "FREDRIK").
> I want to get the names in the usual format (First letter
> capitalized)
> "Fredrik". How
> do I do that?
Well, the good news is that someone has already written a function to do
what you want in one operation. see:
http://www.postgresql.org/idocs/index.php?functions-string.html
Ah, a former MS SQL Server user. Transact-SQL uses quite a few bits of
syntax which are *not* ANSI SQL 92 standard; the use of "+" for
concatination is one of them. It would pay for you to pick up an
introductory PostgreSQL book just to get a handle on the differences
(also, training in real SQL 92 syntax will help you with other
databases, such as Oracle or FrontBase).
-Josh Berkus
______AGLIO DATABASE SOLUTIONS___________________________
Josh Berkus
Complete information technology josh(at)agliodbs(dot)com
and data management solutions (415) 565-7293
for law firms, small businesses fax 621-2533
and non-profit organizations. San Francisco
Attachment | Content-Type | Size |
---|---|---|
unknown_filename | text/plain | 2 bytes |
unknown_filename | text/plain | 2 bytes |
unknown_filename | text/plain | 2 bytes |
From | Date | Subject | |
---|---|---|---|
Next Message | Mark McArthey | 2001-10-23 17:36:28 | dynamic #include's? |
Previous Message | Aasmund Midttun Godal | 2001-10-23 16:31:12 | Re: PL/pgSQL triggers ON INSERT OR UPDATE |