Search code examples
sqlbinary-datasql-server-2005-express

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


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


Solution

  • 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