2011-05-31 209 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