I use SQL Server 2005. I wanted to know if it is even possible to read binary data printed from SQL-Server in other environments such as Matlab?
For example,
SET NOCOUNT ON
CREATE TABLE #Temp ( C1 binary ) INSERT INTO #Temp (C1) SELECT 100
SELECT * FROM #Temp
DROP TABLE #Temp
The result is 0x64 which I believe is hexadecimal notation. This data when viewed using notepad looks the same. However, a binary 100 written from Matlab when opened in notepad is definitely not hexadecimal! Please help/comment!
You should be able to read binary output from SQL Server in other tools, given they handle binary input.
From what you’ve written, you’re not comparing things in an equivalent way (apples-to-apples). Hexadecimal is just one way of representing the bits in human-sensible form, so unless your viewing methods are both capable of using the same notation, you’ll probably see different things. I’m pretty sure Notepad doesn’t do hex.
The SSMS “output” of 0x64 is the tool’s way of representing binary data – in this case, decimal value 100 – in print/on screen. If you cut & paste from the SSMS window, you’re actually cutting the text string “0x64”, so opening that in Notepad will look the same, but it’s not in actuality your original decimal 100 value.
If you’re saving a file from Matlab & opening that in Notepad, you should see the byte value(s) interpreted as text, probably ‘d’ (lower-case “D”) in this case since that’s the ASCII/UTF-8 value for decimal 100.