2011-05-31 212 views

回答

2

tsql使用c#和其他c语言使用的相同位运算符。即| |为或,&为和,^为排他或。

可能是最适合你的问题的一个例子:

select (column1 | column2) from [YourTable]; 

如果你想测试所有选项,你可以试试这个块和测试各种可能性。

declare @col1 bit = 0 /** or 1 or null */ 
declare @col2 bit = 0 /** or 1 or null */ 
declare @col3 bit = null 

set @col3 = (@col1 | @col2) 

在这里阅读更多:http://msdn.microsoft.com/en-us/library/ms176122.aspx