How can I view the contents of sql binary data fields?

Xandir picture Xandir · Feb 10, 2009 · Viewed 41.2k times · Source

Does anybody know how to view the contents of fields containing binary data in an MS SQL Server 2005 database?

Answer

SQLMenace picture SQLMenace · Feb 10, 2009

Depends if it is just text stored as binary or not, if it is then take a look at this

create table #bla (col1 varbinary(400))

insert #bla values(convert(varbinary(400),'abcdefg'))

select col1,convert(varchar(max),col1)
from #bla

output 0x61626364656667 abcdefg