making a binary into a string

  • 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

  • Never mind. I just found

    master.dbo.xp_varbintohexstr

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply