Skip site navigation (1) Skip section navigation (2)

Urgent help in bit_string data type

From: Karthikeyan Sundaram <skarthi98(at)hotmail(dot)com>
To: <pgsql-admin(at)postgresql(dot)org>, <pgsql-sql(at)postgresql(dot)org>
Subject: Urgent help in bit_string data type
Date: 2007-04-11 20:30:57
Message-ID: BAY131-W10EF789544B96131E8A482B05F0@phx.gbl (view raw or flat)
Thread:
Lists: pgsql-adminpgsql-sql


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
----------------------------------
 
insert into test_a values (to_char(1,'9'));
 
ERROR:  column "b" is of type bit but expression is of type textHINT:  You will need to rewrite or cast the expression.
 
Please help me
 
regards
skarthi
 
_________________________________________________________________
i'm making a difference. Make every IM count for the cause of your choice. Join Now.
http://clk.atdmt.com/MSN/go/msnnkwme0080000001msn/direct/01/?href=http://im.live.com/messenger/im/home/?source=wlmailtagline

Responses

pgsql-admin by date

Next:From: Chris HooverDate: 2007-04-11 21:02:12
Subject: Re: Best compressed archive_command on Linux?
Previous:From: Chris HooverDate: 2007-04-11 20:14:12
Subject: Where are aliases stored?

pgsql-sql by date

Next:From: JoeDate: 2007-04-11 21:44:01
Subject: Re: [SQL] Urgent help in bit_string data type
Previous:From: Andrew SullivanDate: 2007-04-11 15:49:23
Subject: Re: A long-running transaction

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group