I have a routine that generates a supposedly unique binary value using a formula. I want to confirm that the generated value is unique within the table name that is passed into the procedure.
I'm trying to generate the dynamic SQL that includes this new binary value as:
declare @binary8Value binary(8)
select @testSQL = 'select count(*) from MyTable where ' + @columnName + ' = ' + @binary8Value
This gives an error, but I get incorrect values when I use
convert(varchar(20), @binary8Value
Any suggestions on how to correctly convert the binary to a string that looks like 0x00005A71006C55ED?
TIA
Andre