Re: Concatenating strings

Поиск
Список
Период
Сортировка
Искать
От
Josh Berkus
Тема
Re: Concatenating strings
Дата
Msg-id
web-490614@davinci.ethosmedia.com
Ответ на
Concatenating strings (Fredrik Thunberg)
Список
Дерево обсуждения
Concatenating strings "Fredrik Thunberg" <fredrik@datessa.se>
Re: Concatenating strings Tom Lane <tgl@sss.pgh.pa.us>
Re: Concatenating strings "Josh Berkus" <josh@agliodbs.com>
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@agliodbs.com
   and data management solutions       (415) 565-7293
  for law firms, small businesses        fax 621-2533
    and non-profit organizations.      San Francisco
В списке pgsql-novice по дате отправления
От: Medve Gábor
Дата:
От: Travis Hoyt
Дата:
FAQ