Toggle a Bit type ie not field - Mailing list pgsql-sql

From Peter Morgan
Subject Toggle a Bit type ie not field
Date
Msg-id 998ntm$1n41$1@news.tht.net
Whole thread Raw
Responses Re: Toggle a Bit type ie not field  (Brent Verner <brent@rcfile.org>)
List 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 beginupdate pcpmanufacturers set def=1 where manufid = @manufID
end

TIA

Pete





pgsql-sql by date:

Previous
From: "Marios Moutzouris"
Date:
Subject: rows equal
Next
From: "Grant Furick"
Date:
Subject: LEFT JOIN