469,646 Members | 1,274 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,646 developers. It's quick & easy.

How to convert binary or hexa to decimal?

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
Jul 23 '05 #1
1 11108

"Adam" <ad**@blah.com> wrote in message
news:7D********************@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_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


I'm not sure I follow your description, but in any event, if you remove the
trailing zeroes, then you can convert to an int:

select cast(0xB4F5 as int)

That could be a valid Unicode character:

http://toni.technetium.be/ascii/unicode.php?nr=180

So if you have the appropriate language support installed in your client,
you may be able to do this:

select nchar(cast(0xB4F5 as int))

See NCHAR() and UNICODE() in Books Online. If this doesn't help, you might
want to clarify what you're looking for, and what you understand the binary
data represents - is every column value a single Unicode character, for
example?

Simon
Jul 23 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by Geoffrey | last post: by
1 post views Thread by ferran | last post: by
3 posts views Thread by Poul Møller Hansen | last post: by
7 posts views Thread by elliotng.ee | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.