Varbinary to varchar in sys.certificates

  • i have an issue , i am trying to do a join on thumbprint field in certificate to a table with thumbprint that i loaded from excel.
    the join is not doing as it is suppose to because one is a varbinary and the other one is a varchar .
    is there a way i can do that ? 

    Thanks Zee

     SELECT *
      FROM X.[dbo].[DomainCmsTde] dc
    full join   master.sys.certificates c on dc.thumbprint1 = CONVERT(varchar(max), c.thumbprint, 0)

  • Just convert the varbinary to varchar using the appropriate style, in this case likely style 1.

    Cheers!

  • I'm guessing here, that what you mean is you have a literal string with a value like '0x4348A46E64C54D543AB46'? Out of interest, considering these values came from Excel, why didn't you load them as a varbinary?

    Anyway, instead of co vetting the binary to a condensed varchar, convert your varchar to a varbinary. Try:
    [Code] CONVERT (varbinary(MAX), YourVarcharBinaryColumn,1)[/code]

    Thom~

    Excuse my typos and sometimes awful grammar. My fingers work faster than my brain does.
    Larnu.uk

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

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