Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 425
Xandir Avatar asked Feb 10 '09 15:02

Xandir


People also ask

How do I view the contents of a SQL database?

Right-click the Products table in SQL Server Object Explorer, and select View Data. The Data Editor launches. Notice the rows we added to the table in previous procedures. Right-click the Fruits table in SQL Server Object Explorer, and select View Data.

How do I view BLOB data in SQL Server?

To read BLOB data, you need to use the SqlDataReader class of ADO.NET. The use of SqlDataReader class to read BLOB data can be best understood with an example. You will develop a simple application that manages photos stored in a SQL Server database.

Can SQL store binary data?

Binary, Varbinary & Varbinary(max) are the binary string data types in SQL Server. These data types are used to store raw binary data up to a length of (32K – 1) bytes. The contents of image files (BMP, TIFF, GIF, or JPEG format files), word files, text files, etc. are examples of binary data.


1 Answers

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

like image 58
SQLMenace Avatar answered Nov 02 '22 04:11

SQLMenace