SQLTeam.com | Weblogs | Forums

Reading hex string in varchar column

As a result of a dumb code error, I have some hex strings (e.g. 0x8F276800EB0DA970) which were inserted in a varchar column but WITHOUT using single quotes. In other words, instead of executing Insert Into TableA (ColumnA) Values ('0x8F276800EB0DA970') which would have been the correct way, I ran Insert Into TableA (ColumnA) Values (0x8F276800EB0DA970). When I look at the content of ColumnA, it looks like jibberish.

There must be a way to read the content of ColumnA back to the original 0x8F276800EB0DA970 string but I haven't figured it out. I tried with Convert but it doesn't work.

Does anyone have a clue as to what to do? Thanks!

cast as varbinary

Oh for crying out loud. That's what happens when one has a negative IQ. Thanks James, I really appreciate it!