TSBA vbinary bitmasking with varbinary right side operator

I am looking for some tips or tricks for this design task. I'm against:

I need to mask two identical sized varbinary fields stored in a database. Just to clarify, no, this is not a "permissions table" or anything else. I would normalize the database for these kinds of items, and this data cannot be normalized. I save the varbinary field to dynamically store the bits that our application generates. I also searched for these bits with another varbinary request. In .net, I use the BigInteger type to handle all bit masking, and it does a great job of this, but I'm thinking of offloading this process on the database server to filter the results before passing it to the caller. Right now I support the varbinary (512) field type and will want to execute both the AND and OR statements and be able to compare if ANY (OR) or ALL (AND) bits are done on the right side of the statement through. MSDN says that you can use varbinary () with the max bigint right-handed operator, however I need to exceed this.

A good resource I found is posting an Adam Machanic blog on this topic, but I want to see if there are other approaches before I break into it.

http://sqlblog.com/blogs/adam_machanic/archive/2006/07/12/bitmask-handling-part-3-logical-operators.aspx

This will be for SQL 2005 or higher. If in 2008 the function was not found in 2005, I would be fine, I simply could not identify it.

Any hints or tricks are welcome.

Thanks.

Travis wattid

+4
source share
1 answer

If you know the maximum length of a bitmap, you CAN propagate it to multiple columns and mask them individually.

It gets very dirty though.

0
source

Source: https://habr.com/ru/post/1392425/


All Articles