Is there a function for Converting a Decimal into BINARY ?

From: "Ow Mun Heng" <ow(dot)mun(dot)heng(at)wdc(dot)com>
To: <pgsql-general(at)postgresql(dot)org>
Subject: Is there a function for Converting a Decimal into BINARY ?
Date: 2009-08-28 01:49:03
Message-ID: D1109E8B2FB53A45BDB60F8145905CE9037D5C79@wdmyexbe03.my.asia.wdc.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi Guys,

Searching the net didn't give me much clues as to how to convert a Decimal
number into BINARY.

Eg:
I have a datatype in the DB which needs to be converted.

DEC = 192
BINARY = 11000000

DEC = 197
BINARY = 11000101

Which I then need to break down into pairs to do calculations on

11 : 00 : 00 : 00
11 : 00 : 01 : 01

Some of the solutions I've seen on the Internet is based on VB and mainly
userland apps, I would like to do the conversion within PG itself.

Thanks

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Harvey, Allan AC 2009-08-28 02:03:14 Re: Is there a function for Converting a Decimal into BINARY ?
Previous Message Merlin Moncure 2009-08-28 00:01:54 Re: Viable alternatives to SQL?