說我有以下幾點:SQL服務器位邏輯操作 - 需要一些幫助
Declare @LineA int
Declare @LineB int
Declare @LineC int
Declare @LineD int
Declare @LineRequested int
Declare @LineTaken int
Set @LineA = 1
Set @LineB = 2
Set @LineC = 4
Set @LineD = 8
Set @LineRequested = 11 -- @LineA | @LineB | @LineD
Set @LineTaken = 2 -- Matches a line in @LineRequested (@LineB)
Set @LineTaken = 4 -- Does not match (Line C was not one of the lines OR'd)
如何測試,看看是否在@LineTaken值彌補了@LineRequested值的ONE?在上面的例子中,當@LineTaken = 2時,它匹配其中一個值(@LineA | @LineB)。但是,第二,它不。我如何以編程方式確定這一點?
是'@ LineTaken'總是2的冪?你一直在尋找一條線嗎?如果不是'@ LineTaken'例如是5時會發生什麼?如果** 1和4匹配或兩者匹配,你會想匹配嗎? – 2011-03-31 12:24:04