Re: How to format strings

From: Warren Vanichuk <pyber(at)street-light(dot)com>
To: Ian Willis <Ian(dot)Willis(at)ento(dot)csiro(dot)au>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: How to format strings
Date: 2000-11-09 05:52:43
Message-ID: Pine.LNX.4.21.0011082151430.12417-100000@urd.street-light.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

> Some time ago I saw the someone give an example of how to combine a
> query result with test using sql.
> What i have is a table with f_name varchar l_name varchar and I want the
> result to say f_name(dot)l_name(at)mydomain(dot)com
> Is this possible I will redirect the output to a textfile using the \o
> option.

The only way I could come up with to do this is :

test=> \d test
Table = test
+----------------------------------+----------------------------------+-------+
| Field | Type | Length|
+----------------------------------+----------------------------------+-------+
| text1 | varchar() | 255 |
| text2 | varchar() | 255 |
+----------------------------------+----------------------------------+-------+

test=> select textcat( textcat( textcat( text1, '.' ), text2 ), '@domain.com' ) as result from test;
result
------------------
foo(dot)bar(at)domain(dot)com
bar(dot)vaz(at)domain(dot)com
bar(dot)foo(at)domain(dot)com
(3 rows)

Perhaps somebody has a better way? :)

Hope this helps! :)

Sincerely, Warren

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Denis A. Doroshenko 2000-11-09 08:37:53 need an information on PostgreSQL
Previous Message Ian Willis 2000-11-09 05:36:23 How to format strings