I have a table which has a varbinary column I would like to select all rows where the first byte of that data is 0x0b
Is there a way to for a query which will select based on the compare of the first byte?
Maybe using a 'like'?
Thanks
I have a table which has a varbinary column I would like to select all rows where the first byte of that data is 0x0b
Is there a way to for a query which will select based on the compare of the first byte?
Maybe using a 'like'?
Thanks
Not in MySQL (which I'm assuming you are using based on the tags).
If you have the ability to create tables, I would recommend creating a sharding table that separates the bits you would need to query against into individual tinyint
columns. You would need to handle the sharding outside of the DBMS since triggers wont be able to help, but having a sharding table would certainly make these types of queries much faster.
If not, then you are going to have to do a query for greater than & less than and then cycle through on a bitwise operation.
Both of these solutions assume to have access to the requesting system. If you are strictly DBA, then no.