Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 Ampersand in a WHERE condition

Author  Topic 

TeresitaCastro
Starting Member

2 Posts

Posted - 2011-01-12 : 15:39:59
Hi,
I am analysing the next statement, and don't know what does this condition of my WHERE clause.


WHERE (TASKS.STATUS = 1 OR (TASKS.STATUS = 3 AND (TASKS.SUBSTATUS & 4 <> 4)))

This part:
(TASKS.SUBSTATUS & 4 <> 4)))

The filed SUBSTATUS is int and allows nulls.

[SUBSTATUS] [int] NULL

russell
Pyro-ma-ni-yak

5072 Posts

Posted - 2011-01-12 : 15:52:38
It's a bitwise and. See here for full explanation: http://msdn.microsoft.com/en-us/library/ms174965(v=sql.90).aspx
Go to Top of Page

Michael Valentine Jones
Yak DBA Kernel (pronounced Colonel)

7020 Posts

Posted - 2011-01-12 : 16:00:10
& is a bitwise operator.

That is a test to see if bit 3 is on ( 4 = 100 binary)





CODO ERGO SUM
Go to Top of Page
   

- Advertisement -