I have already posted asking for help (see below) but hit a brick wall. I
would like to see a modification to allow the conversion from Hex to Dec.
I am trying to convert from hex to decimal and can do that successfully
using the following code:
which outputs 255 and is exactly what I want.
I want to substitute the string in the code 'FF' for a column in the
database like so:
SELECT x'db_column'::integer FROM db_table;
but no matter the combinations I try, I cannot get it to work.
Thew data colum contains html color codes like "0099FF" and I want to
convert these to, in this case, "0 153 255".
The following code behaves well:
SELECT x'00'::integer || ' ' || x'99'::integer || ' ' || x'FF'::integer;
resulting in "0 153 255". All correct
I was hopeful that something similar to the following would work but I just
cannot get it to work despite trying various combinations.
SELECT x'substring(col,1,2)'::integer || ' ' ||
x'substring(col,3,2)'::integer || ' ' || x'substring(col,5,2)'::integer
From: Steve Crawford [mailto:scrawford(at)pinpointresearch(dot)com]
Sent: 12 November 2010 21:01
To: Donald Kerr
Subject: Re: [NOVICE] Postgres Wishlist
On 11/12/2010 12:00 PM, Donald Kerr wrote:
> Probably not the correct place to post this message but is there a
> means whereby I can post a suggestion to a PostgreSQL wishlist?
In my experience, the best first-step is to ask for help. Explain what
you are trying to solve or the problem you are encountering. In many if
not most cases there is either a solution or explanation. If not, you
will at least have better info about how (and whether or not it would be
productive) to frame your request.
No virus found in this message.
Checked by AVG - www.avg.com
Version: 10.0.1153 / Virus Database: 424/3253 - Release Date: 11/12/10
In response to
pgsql-novice by date
|Next:||From: LazyTrek||Date: 2010-11-12 21:23:53|
|Subject: Re: login error - Warning: pg_connect(): Unable to connect
to PostgreSQL server: FATAL: password authentication failed for user "kamik"|
|Previous:||From: Leon Starr||Date: 2010-11-12 21:16:59|
|Subject: How to properly SET NULL on a delete with two attributes referenced?|