473,790 Members | 3,265 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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_Gene ral_CP1_CI_AS
(default).

For example the content of the field is:
(0xB4F500000000 0000) 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(0xB4F50000 00000000 as decimal(8,2))

Any help is appreciated,
Adam
Jul 23 '05 #1
1 11742

"Adam" <ad**@blah.co m> wrote in message
news:7D******** ************@ne ws20.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_Gene ral_CP1_CI_AS
(default).

For example the content of the field is:
(0xB4F500000000 0000) 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(0xB4F50000 00000000 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(0xB4 F5 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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
4570
by: Geoffrey | last post by:
I am working on a file conversion project that reads data from a one file format, reformats in and writes in out to another. The data is records of informations - names address, account number,statistics. The numeric values in the original file are stored in what appears to be a "packed" data format,using a structure that does not use any of the more standard "C" formats, so I can't use the "struct" module. As an example, the number...
1
2578
by: ferran | last post by:
Hi, does anybody know how to convert in C++ from base 10 to any other base without loosing the decimal part of the actual value? I came up with this algorithm to convert from decimal to any base but I'm not sure what to do to include the decimal part. //----------------------------------------------------------- const char ccBaseChars = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"; char sResult = {0}; int iBase;
3
1893
by: Poul Møller Hansen | last post by:
I'm struggling supporting national characters of different origin in a mixed environment using PHP, Perl and Java. I have a database created with character set UTF-8, but I'm in doubt when the data is stored as UTF-8 or latin1-9 then the clients are also doing some automatic character conversion. For this reason I need a way to see how the data are stored in the database
13
9248
by: Jason | last post by:
Could someone here show me how I would write a vb program to convert decimal ip address to binary? For example a small form with a convert button and a label for the result and a textbox for the ip. So I would want 11000000 10101000 00000010 00001010 tp show up inthe label if I entered 192.168.2.10 into the text box. I have no idea even how to begin this, any help would be great.
7
19234
by: elliotng.ee | last post by:
I have a text file that contains a header 32-bit binary. For example, the text file could be: %%This is the input text %%test.txt Date: Tue Dec 26 14:03:35 2006 00000000000000001111111111111111 11111111111111111111111111111111 00000000000000000000000000000000 11111111111111110000000000000000
28
5934
by: FAQ server | last post by:
----------------------------------------------------------------------- FAQ Topic - How do I convert a Number into a String with exactly 2 decimal places? ----------------------------------------------------------------------- When formatting money for example, to format 6.57634 to 6.58, 6.5 to 6.50, and 6 to 6.00? Rounding of x.xx5 is uncertain, as such numbers are not represented exactly. See section 4.7 for Rounding issues.
2
3153
by: mshahzadali | last post by:
is there any expert who could guide me making a C++ program. I want to convert a Decimal number into a Binary, Octal and a Hexadecimal Number using a C++ Built-in Function(if there exist any).
0
2233
by: Metalpalo | last post by:
Hello everybody I created small batch file in MSDOS. In this batch file i need to print hexadecimal value of some env. variable. For example: I enter value via command :set /P PAR=Enter number: I enter number 10 and I want to print its hexa value thats mean 0A. Is possible to achieve ot in MSDOS without some shell.
9
3479
by: Leo jay | last post by:
i'd like to implement a class template to convert binary numbers to decimal at compile time. and my test cases are: BOOST_STATIC_ASSERT((bin<1111,1111,1111,1111>::value == 65535)); BOOST_STATIC_ASSERT((bin<1111>::value == 15)); BOOST_STATIC_ASSERT((bin<0>::value == 0)); BOOST_STATIC_ASSERT((bin<1010, 0011>::value == 163)); you can find my implementation at:
0
10419
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10201
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10147
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9987
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7531
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5552
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4100
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3709
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2910
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.