From: Peter Morgan <mash@daffodil.uk.com>
To: pgsql-sql@postgresql.org
Subject: Toggle a Bit type ie not field
Date: Tue, 20 Mar 2001 23:07:22 -0000
Message-ID: <998ntm$1n41$1@news.tht.net> (raw)
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-sql@postgresql.org
Cc: mash@daffodil.uk.com
Subject: Re: Toggle a Bit type ie not field
In-Reply-To: <998ntm$1n41$1@news.tht.net>
References: <998ntm$1n41$1@news.tht.net>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox