Re: [ADMIN] [SQL] Urgent help in bit_string data type

2007-04-11 Thread Joe
Hi skarthi, On Wed, 2007-04-11 at 16:29 -0700, Karthikeyan Sundaram wrote: > The reason why I am asking is, we are building an interface layer > where all our users will have a view. They shouldn't know anything > about how and where the data is stored in the table. They can be seen > only by

Re: [ADMIN] [SQL] Urgent help in bit_string data type

2007-04-11 Thread Karthikeyan Sundaram
Regards skarthi> Date: Wed, 11 Apr 2007 19:00:23 -0400> From: [EMAIL PROTECTED]> Subject: Re: [ADMIN] [SQL] Urgent help in bit_string data type> To: [EMAIL PROTECTED]> CC: pgsql-admin@postgresql.org; pgsql-sql@postgresql.org> > Hi skarthi,> > On Wed, 2007-04-11 at 15

Re: [ADMIN] [SQL] Urgent help in bit_string data type

2007-04-11 Thread Joe
Hi skarthi, On Wed, 2007-04-11 at 15:01 -0700, Karthikeyan Sundaram wrote: > create table test_a (b bit(3)); > > create view test_vw (b1, b2, b3) > as select > to_number(substring(b,1,1)::int,'9') as b1, > to_number(substring(b,2,1)::int,'9') as b2, > to_number(substring(b,3,1)::int,'9') as b3 f

Re: [ADMIN] [SQL] Urgent help in bit_string data type

2007-04-11 Thread Karthikeyan Sundaram
; Date: Wed, 11 Apr 2007 17:44:01 -0400> From: [EMAIL PROTECTED]> Subject: Re: > [ADMIN] [SQL] Urgent help in bit_string data type> To: [EMAIL PROTECTED]> CC: > pgsql-admin@postgresql.org; pgsql-sql@postgresql.org> > Hi skarthi,> > On > Wed, 2007-04-11 at 13:30 -

Re: [SQL] Urgent help in bit_string data type

2007-04-11 Thread Joe
Hi skarthi, On Wed, 2007-04-11 at 13:30 -0700, Karthikeyan Sundaram wrote: > insert into test_a values (to_char(1,'9')); > > ERROR: column "b" is of type bit but expression is of type > text > HINT: You will need to rewrite or cast the expression. As su

[SQL] Urgent help in bit_string data type

2007-04-11 Thread Karthikeyan Sundaram
Hi Gurus, I have a table with datatype as bitstrings create table test_a (b bit(3)); insert into test_a values ('111'); This will convert a bit to a number == select to_number((substring(b,1,1)::int),9)+3 from test_a; How will I convert a Number to a bit --