From: Ramakrishnan Muralidharan <ramakrishnanm@pervasive-postgres.com>
To: Fernando Grijalba <fgrijalba@gmail.com>
To: pgsql-sql@postgresql.org
Subject: Re: Convert int to hex
Date: Thu, 2 Jun 2005 14:47:40 +0530
Message-ID: <02767D4600E59A4487233B23AEF5C59922C2B8@blrmail1.aus.pervasive.com> (raw)
Hi,
You can use to_hex() function to convert integer to hexa number. I have tried with a small example.
create table testing( id int4 , sHex varchar( 20 ) )
insert into testing( id ) values( 204678 );
insert into testing( id ) values( 2076876 );
update testing set sHex = ( cast( to_hex( id ) as varchar( 20 ) ) )
select * from testing
Id | shex
-------|------
204678 | 31f86
2076876| 1fb0cc
Regards,
R.Muralidharan
-----Original Message-----
From: pgsql-sql-owner@postgresql.org
[mailto:pgsql-sql-owner@postgresql.org]On Behalf Of Fernando Grijalba
Sent: Thursday, June 02, 2005 2:12 AM
To: pgsql-sql@postgresql.org
Subject: [SQL] Convert int to hex
I want to be able to change an int4 from a sequence and store it as
varchar in the database as a hex number.
Is this possible?
Thank you,
Fernando
---------------------------(end of broadcast)---------------------------
TIP 4: Don't 'kill -9' the postmaster
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-sql@postgresql.org
Cc: ramakrishnanm@pervasive-postgres.com, fgrijalba@gmail.com
Subject: Re: Convert int to hex
In-Reply-To: <02767D4600E59A4487233B23AEF5C59922C2B8@blrmail1.aus.pervasive.com>
References: <02767D4600E59A4487233B23AEF5C59922C2B8@blrmail1.aus.pervasive.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox