Reputation: 1156
I have made a quite a few Googling but unfortunately, I could not find a definitive answer for my question.
Please see the following simple query;
DECLARE @Bin binary(3) = 754645
Select @Bin
Even though the variable type is binary, it is being spit out as a hexadecimal value. I just would like to know why.
My thinking is that, it is probably to save from space based on how SQL Server stores the data. Please let me know your thoughts.
Thanks.
Upvotes: 1
Views: 139
Reputation: 5916
Hexdecimal is just a easy way represent binary data. So SQL Server is just printing it as hex to make it easy for you, but it is still stored as binary.
Upvotes: 2
Reputation: 393
Your select statement returned the raw binary data to whatever client you were using to connect to your SQL Server. The client decided to display the binary data in hex.
Upvotes: 1