I have a Delta Table Emp with HashKey column as a binary data type.
The HashKey values are like OTg0MTIzMjUyMTk4NzExZmM1ODM4MWMxODJiMGMyMTY, MjEwYjE4ZTUwNTJlOTU0NzY1ZTgzODIwNTg4MGNkZjA=
etc..
When I am trying to do
select * from Emp
where HashKey='OTg0MTIzMjUyMTk4NzExZmM1ODM4MWMxODJiMGMyMTY'
It’s not working.
1
You are trying to equate a string to a binary but they are not the same datatype, so you need to include a conversion in your equation, like this:
where CONVERT(varchar(max),HashKey,2)='OTg0MTIzMjUyMTk4NzExZmM1ODM4MWMxODJiMGMyMTY'