Home > Archive > MS SQL Data Warehousing > May 2005 > How to convert binary or hexa to decimal?









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author How to convert binary or hexa to decimal?
Adam

2005-05-11, 11:23 am

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_C
P1_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(0xB4F5000000000
000 as decimal(8,2))

Any help is appreciated,
Adam



Adam Machanic

2005-05-12, 1:23 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
--


"Adam" <adam@blah.com> wrote in message
news:y3pge.32447$B82.814560@news20.bellglobal.com...
> 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_C
P1_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(0xB4F5000000000
000 as decimal(8,2))
>
> Any help is appreciated,
> Adam
>
>
>



Michelle Campbell via SQLMonster.com

2005-05-22, 8:23 pm

I always use convert(int,0xB4F500
0000000000) to convert my varbinary
columns. As far as I know they never have decimal places so int is just
fine.
Sponsored Links





Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive | Programming forum archive

Copyright 2009 droptable.com