T-SQL 位运算 sum 写法

select cast(sum(sheettype & 8) as bit) * 8
 + cast(sum(sheettype & 4) as bit) * 4
 + cast(sum(sheettype & 2) as bit) * 2
 + cast(sum(sheettype & 1) as bit) AS sumsheettype

 

posted @ 2014-10-23 13:13  Tom.汤  阅读(288)  评论(0)    收藏  举报