Re: [SQL] Converting integer to binary

2004-06-11 Thread Stephen Quinney
On Thu, Jun 10, 2004 at 05:27:31PM -0500, Bruno Wolff III wrote: > On Thu, Jun 10, 2004 at 13:24:15 -0700, > Chris Gamache <[EMAIL PROTECTED]> wrote: > > Following up on the cast to bit idea, he could do something like > casting to bit(32). I don't think there is an easy way to get this > cast t

Re: [SQL] Converting integer to binary

2004-06-10 Thread Bruno Wolff III
On Thu, Jun 10, 2004 at 13:24:15 -0700, Chris Gamache <[EMAIL PROTECTED]> wrote: Following up on the cast to bit idea, he could do something like casting to bit(32). I don't think there is an easy way to get this cast to string, so it may not completely solve his problem, depending on what he wa

Re: [SQL] Converting integer to binary

2004-06-10 Thread Chris Gamache
Once upon a time in PostgreSQL there was a function : bitfromint4 ... Any idea where it has disappeared to? You can do # select B'10101101'::int4; int4 -- 173 (1 row) but you want to go # select 173::varbit; which is what bitfromint4 used to do. CG --- Bruno Wolff III <[EMAIL PROTECT

Re: [SQL] Converting integer to binary

2004-06-10 Thread Bruno Wolff III
On Thu, Jun 10, 2004 at 14:52:41 +0100, Stephen Quinney <[EMAIL PROTECTED]> wrote: > > I have searched around but I cannot see any standard way in PostgreSQL > to convert from an integer into a binary representation. > > Now I have an algorithm to do it so I could write an SQL function, I > gue

[SQL] Converting integer to binary

2004-06-10 Thread Stephen Quinney
I have searched around but I cannot see any standard way in PostgreSQL to convert from an integer into a binary representation. i.e. I want to do: 16 ==> 1 32 ==> 10 64 ==> 100 96 ==> 110 etc.. Now I have an algorithm to do it so I could write an SQL function, I guess. If there