Ramon Smits

Tell me your secrets and i'll tell you mine

Recent Posts

Tags

Community

Email Notifications

Patterns & Practices / Guidelines

EntLib

Nant

Blogs that I monitor

Archives

Mssql: Cannot use bitwise operators on varbinary or numeric

I want to perform bitwise operations on a varbinary colum. As it contains binary data I though that it would work but it didn't

This example works: 

declare @a int
declare @b int

set @a = 1
set @b = 2

select @a | @b

But this wont:

declare @a varbinary(100)
declare @b varbinary(100)

set @a = 1
set @b = 2

select @a | @b


The same problem with numeric data type. So that currently leaves me without a mssql solution. I guess I have to fallback to code to perform the conversion that I need.
Leave a Comment

(required) 

(required) 

(optional)

(required) 


Please add 7 and 4 and type the answer here: