skip to main
|
skip to sidebar
The Code is a Lie
Software, C#, T-SQL
Friday, June 29, 2007
T-SQL bitwise not
Today I stumbled upon a feature in T-Sql that I haven't found before. I was looking for a way to do a bitwise not. I've seen this done with a case statement in a couple of places however it's clumsy and verbose:
CASE WHEN
my_bit_f = 1
THEN
0
ELSE
1
END
Instead this can be simplified to:
~my_bit_f
MSDN:
http://msdn2.microsoft.com/en-us/library/ms173468.aspx
Newer Posts
Home
Subscribe to:
Posts (Atom)
Blog Archive
►
2008
(1)
►
August
(1)
▼
2007
(5)
►
November
(1)
►
October
(2)
►
July
(1)
▼
June
(1)
T-SQL bitwise not
About Me
mize
View my complete profile