RE: Re: how do you convert from hex to integer using SQL ?
Posted in 2005
Topics: General Discussion
Rajib,
I played with your sql: "select '0xa' + 0 from systables where tabid =
1;" ... "It'll print the integer value of the hex"
I ran this:
select tabname, partnum,
hex(partnum), ('0xa' + hex(partnum))
from systables
I get results like:
tabname ebkpf (SAP table names...)
partnum 62914738
(expression) 0x03C000B2
(expression) 62914748.0000000
tabname syschecks
partnum 1048716
(expression) 0x0010008C
(expression) 1048726.00000000
tabname syscoldepend
partnum 1048718
(expression) 0x0010008E
(expression) 1048728.00000000
Shouldn't the partnum and the second expression be equal based on your
suggestion, or am I doing something wrong?
Thanks,
Norma Jean
-----Original Message-----
From: Rajib Sarkar <rsarkar@us.ibm.com>
To: darren.edgerton@reece.com.au
Date: Wed, 5 Jan 2005 13:00:28 -0700
Subject: Re: how do you convert from hex to integer using SQL ?
Its pretty simple actually ..:-)
u can try something like:
select '0xa' + 0 from systables where tabid = 1;
It'll print the integer value of the hex. U can substitute ur column
instead of the hard-coded value in the example.
Thanx much,
Rajib Sarkar
Advisory Software Engineer
DB2/UDB Regional Advanced Support
IBM Data Management Group
darren.edgerton@r
eece.com.au
Sent by:
To
owner-informix-li informix-list@iiug.org
st@iiug.org
cc
Subject
01/05/2005 12:09 how do you convert from hex to
AM integer using SQL ?
Please respond to
darren.edgerton
Hi,
i need to conv from Hex to Integer
can this be done using SQL with Informix ??
Ie
select integer(hex_data_column) from mytable
thanks,
============================================================
The information contained in this message may be privileged
and confidential and protected from disclosure. If the reader
of this message is not the intended recipient, or an employee
or agent responsible for delivering this message to the
intended recipient, you are hereby notified that any reproduction,
dissemination or distribution of this communication is strictly
prohibited. If you have received this communication in error,
please notify us immediately by replying to the message and
deleting it from your computer. Thank you. Tellabs
============================================================
sending to informix-list
"Sebastian, Norma J." wrote:
>
> Rajib,
>
> I played with your sql: "select '0xa' + 0 from systables where tabid =
> 1;" ... "It'll print the integer value of the hex"
>
> I ran this:
> select tabname, partnum,
> hex(partnum), ('0xa' + hex(partnum))
> from systables>
> I get results like:
>
> tabname ebkpf (SAP table names...)
> partnum 62914738
> (expression) 0x03C000B2
> (expression) 62914748.0000000
>
> tabname syschecks
> partnum 1048716
> (expression) 0x0010008C
> (expression) 1048726.00000000
>
> tabname syscoldepend
> partnum 1048718
> (expression) 0x0010008E
> (expression) 1048728.00000000
>
>
> Shouldn't the partnum and the second expression be equal based on your
> suggestion, or am I doing something wrong?
Using Rajib's example (select '0xa' + 0 from systables where tabid = 1;), I
get a constant value of 10.0000000000000. Your select is adding 10 to the
partnum, as the second expression shows.
--
June Hunt