Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

hexadecimal to decimal

Status
Not open for further replies.

chaoma

Technical User
Apr 17, 2005
101
US
Hello,

I need to convert hexadecimal number such as 7B479E9 back to decimal number in SQL 2000. Is there anyway to do this?

Thanks.
 
select power(16,0)*(charindex('9','0123456789ABCDEF')-1)
+ power(16,1)*(charindex('E','0123456789ABCDEF')-1)
+ power(16,2)*(charindex('9','0123456789ABCDEF')-1)
+ power(16,3)*(charindex('7','0123456789ABCDEF')-1)
+ power(16,5)*(charindex('4','0123456789ABCDEF')-1)
+ power(16,6)*(charindex('B','0123456789ABCDEF')-1)
+ power(16,7)*(charindex('7','0123456789ABCDEF')-1)

answer: 2,067,823,081

rudy | r937.com | Ask the Expert | Premium SQL Articles
SQL for Database-Driven Web Sites (next course starts May 8 2005)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top