all groups > sql server data warehouse > may 2005 >
You're in the

sql server data warehouse

group:

How to convert binary or hexa to decimal?


How to convert binary or hexa to decimal? Adam
5/11/2005 10:57:33 AM
sql server data warehouse:
Hello,

I'm trying to decifer the data in the table that stores the data in the
binary format. All numbers are placed in varbinary fields. All I know is the
MS SQL 2000 database useing collation SQL_Latin1_General_CP1_CI_AS
(default).

For example the content of the field is:
(0xB4F5000000000000) in unicode and defined as varbinary(8).

Are there any procedures that convert the unicode binary (or hexa) numbers
back to ascii or readable form?

I tried as following but it didn't work.
select cast(0xB4F5000000000000 as decimal(8,2))

Any help is appreciated,
Adam


Re: How to convert binary or hexa to decimal? Adam Machanic
5/12/2005 12:50:54 PM
Hi,

There is no such thing as "unicode binary". Unicode is a character encoding
format. Binary is enencoded ("raw", if you will.)

What format was the data before you converted it to binary? Is it a decimal
number? Or is it some characters? Or..?


--
Adam Machanic
SQL Server MVP
http://www.datamanipulation.net
--


[quoted text, click to view]

Re: How to convert binary or hexa to decimal? Michelle Campbell via SQLMonster.com
5/22/2005 10:49:05 PM
I always use convert(int,0xB4F5000000000000) to convert my varbinary
columns. As far as I know they never have decimal places so int is just
AddThis Social Bookmark Button