Does anybody know how to view the contents of fields containing binary data in an MS SQL Server 2005 database?
            Asked
            
        
        
            Active
            
        
            Viewed 4.9k times
        
    17
            
            
        - 
                    If the data is binary... how would you "view" it? – ahockley Feb 10 '09 at 15:34
 - 
                    It may be a string in which case viewing it in ascii or hex form would suffice. At the moment all I see is
. – Xandir Feb 10 '09 at 15:36 - 
                    use a query not the open table wizard, see my answer below – SQLMenace Feb 10 '09 at 15:50
 
1 Answers
23
            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
        SQLMenace
        
- 132,095
 - 25
 - 206
 - 225
 
- 
                    Thanks. I was hoping for a utility to take some of the legwork out of it but this is a workable solution. – Xandir Feb 10 '09 at 16:04