What does the \"&\" mean here:
select pt.TrTp, sum(pt.TrTp)
from ProdTr pt
where TransSt & 16 <> 16 // this is the row that i don´t understand..
g
It's a bitwise AND.
The & bitwise operator performs a bitwise logical AND between the two expressions, taking each corresponding bit for both expressions. The bits in the result are set to 1 if and only if both bits (for the current bit being resolved) in the input expressions have a value of 1; otherwise, the bit in the result is set to 0.
From http://msdn.microsoft.com/en-us/library/ms174965.aspx
In this case it's used with a flag, where multiple values are stored in one field and then the bitwise AND operation is used to check for specific states - or in this particular case - check that the field doesn't contain the specified state.