I have few columns which has values either 1 or 0. Final result i have to store in one column(F), Which should perform OR operation.
-
Final result of what operation? – Learning_DBAdmin Apr 6 at 7:43
-
@Learning_DBAdmin Coulmn F should have 1 when there is 1 in any one of the columns(a1,a2,a3)--OR operation – Teju Apr 6 at 7:47
These are known as bitwise operators & described in the MS documentation. By the sound of it the one you want is a pipe |
create table #t (cola bit,colb bit, colc bit)
insert #t values(1,0,1)
insert #t values(1,1,0)
insert #t values(0,0,0)
select cola|colb|colc from #t