?
Solved

How to convert a hexadecimal value to decimal value in Sql Server 2008

Posted on 2011-05-09
2
Medium Priority
?
542 Views
Last Modified: 2012-05-11
Hello all,

I am having a tough time trying to complete a task and all searches give a few examples but not exactly what I need.

Ex.
FileName      FileContent
64191           'Some content from file'
49612            'Some content from file'

When I use a scentific calculator or go to a site like   http://www.easycalculation.com/hex-converter.php and input my files above in the hexa section 64191 it converts to decimal 410001 and 49612 converts to decimal 300562.

I need to be able to create a new row in the table above that will give the hexa filename; converted decimal filename; with its file content.

Please help and if I am not explaining this correctly I tried to give what I am after.
0
Comment
Question by:Sqlspider
2 Comments
 
LVL 34

Accepted Solution

by:
Paul MacDonald earned 2000 total points
ID: 35721388
This page has a function for converting from any base (between 2 and 32) to decimal:
     http://dpatrickcaldwell.blogspot.com/2009/05/converting-hexadecimal-or-binary-to.html

You can use it as is, or hard-code it to convert from base 16.
0
 

Author Comment

by:Sqlspider
ID: 35721884
Thanks much Paulmacd this did do the trick for me. I did have to change the base to get the value but it is all well now.  Thanks for the quick answer.
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Long way back, we had to take help from third party tools in order to encrypt and decrypt data.  Gradually Microsoft understood the need for this feature and started to implement it by building functionality into SQL Server. Finally, with SQL 2008, …
How to leverage one TLS certificate to encrypt Microsoft SQL traffic and Remote Desktop Services, versus creating multiple tickets for the same server.
As many of you are aware about Scanpst.exe utility which is owned by Microsoft itself to repair inaccessible or damaged PST files, but the question is do you really think Scanpst.exe is capable to repair all sorts of PST related corruption issues?
With just a little bit of  SQL and VBA, many doors open to cool things like synchronize a list box to display data relevant to other information on a form.  If you have never written code or looked at an SQL statement before, no problem! ...  give i…

850 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question