Re: change the last bit

From: Tony Li <tony(dot)li(at)tony(dot)li>
To: homecurr(at)yahoo(dot)com
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: change the last bit
Date: 2004-07-16 19:58:20
Message-ID: 7C688D76-D762-11D8-BAF5-000A95D1475E@tony.li
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Jul 12, 2004, at 11:07 AM, homecurr(at)yahoo(dot)com wrote:

> I have a int4 coloumn, and I want to change the last bit the the
> number in this column to 0. How can I do it?
>

cfgtools=# \d delme
Table "public.delme"
Column | Type | Modifiers
--------+---------+-----------
num | integer |

cfgtools=# select * from delme;
num
-----
3
4
5
(3 rows)

cfgtools=# update delme set num = num & x'fffffffe'::int4 where num = 3;
UPDATE 1
cfgtools=# select * from delme;
num
-----
4
5
2
(3 rows)

cfgtools=#

In response to

Browse pgsql-general by date

  From Date Subject
Next Message gnari 2004-07-16 20:26:01 Re: Three versions of Pg.pm on my machine
Previous Message Edwin Quijada 2004-07-16 19:46:08 Re: [pgsql-es-ayuda] Postgres & Suse