Toggle a Bit type ie not field

From: "Peter Morgan" <mash(at)daffodil(dot)uk(dot)com>
To: pgsql-sql(at)postgresql(dot)org
Subject: Toggle a Bit type ie not field
Date: 2001-03-20 23:07:22
Message-ID: 998ntm$1n41$1@news.tht.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Here's the SP that toggles a Bit datatype. How would I make it comething
like
???
update pcpmanufacturers set def = not (def) where ManufID = @ManufID

----------------------------------------------------------------------
create Procedure pcp_manufToggle
@ManufID int

as

Set nocount on

declare @S as bit
select @s = def from pcpManufacturers where ManufID = @ManufID

if (@s = 1) begin

update pcpManufacturers set def=0 where manufID = @ManufID
end
else begin
update pcpmanufacturers set def=1 where manufid = @manufID
end

TIA

Pete

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Jie Liang 2001-03-21 00:03:17 I cannot vacuum
Previous Message Grant Furick 2001-03-20 23:00:08 LEFT JOIN