pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Toggle a Bit type ie not field
2+ messages / 2 participants
[nested] [flat]

* Toggle a Bit type ie not field
@ 2001-03-20 23:07 Peter Morgan <mash@daffodil.uk.com>
  2001-03-21 20:20 ` Re: Toggle a Bit type ie not field Brent Verner <brent@rcfile.org>
  0 siblings, 1 reply; 2+ messages in thread

From: Peter Morgan @ 2001-03-20 23:07 UTC (permalink / raw)
  To: 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






^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: Toggle a Bit type ie not field
  2001-03-20 23:07 Toggle a Bit type ie not field Peter Morgan <mash@daffodil.uk.com>
@ 2001-03-21 20:20 ` Brent Verner <brent@rcfile.org>
  0 siblings, 0 replies; 2+ messages in thread

From: Brent Verner @ 2001-03-21 20:20 UTC (permalink / raw)
  To: Peter Morgan <mash@daffodil.uk.com>; +Cc: pgsql-sql

On 20 Mar 2001 at 23:07 (-0000), Peter Morgan wrote:
| 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

update pcpmanufacturers set def=(1-def) where ManufID=@ManufID;

hth.
	brent

-- 
 - - - - - - - -=(   d a m o n   b r e n t   v e r n e r   )=- - - - - - - - - 
               c e r t i f i e d   n o s o u r c o p h o b i c



^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2001-03-21 20:20 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2001-03-20 23:07 Toggle a Bit type ie not field Peter Morgan <mash@daffodil.uk.com>
2001-03-21 20:20 ` Brent Verner <brent@rcfile.org>

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