all groups > sql server odbc > august 2004 >
You're in the

sql server odbc

group:

not function


Re: not function Brannon Jones
8/23/2004 11:37:43 AM
sql server odbc:
It's ugly, but you can do the following:

update myTable set myField = case myField when 0 then 1 when 1 then 0 end

Or you can write your own user-defined function:

create function myNot(@v bit) returns bit
as
begin
declare @r bit

set @r = case @v when 1 then 0 when 0 then 1 end

return @r
end

and use it like so:

update myTable set myField = dbo.myNot(myField)

Brannon

[quoted text, click to view]
not function Michel
8/23/2004 6:08:26 PM
I'd like to do the following query

update myTable set myField = not (myField)

But it looks like not isn't a function.
How can I write this?

Thank you

AddThis Social Bookmark Button