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

Posted on 2011-05-09
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.

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

When I use a scentific calculator or go to a site like 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.
Question by:Sqlspider
    LVL 33

    Accepted Solution

    This page has a function for converting from any base (between 2 and 32) to decimal:

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

    Author Comment

    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.

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    How to run any project with ease

    Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
    - Combine task lists, docs, spreadsheets, and chat in one
    - View and edit from mobile/offline
    - Cut down on emails

    Naughty Me. While I was changing the database name from DB1 to DB_PROD1 (yep it's not real database name ^v^), I changed the database name and notified my application fellows that I did it. They turn on the application, and everything is working. A …
    Hi all, It is important and often overlooked to understand “Database properties”. Often we see questions about "log files" or "where is the database" and one of the easiest ways to get general information about your database is to use “Database p…
    It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
    In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor ( If you're interested in additional methods for monitoring bandwidt…

    759 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

    Need Help in Real-Time?

    Connect with top rated Experts

    11 Experts available now in Live!

    Get 1:1 Help Now