May 2, 2005 #1 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.
Hello, I need to convert hexadecimal number such as 7B479E9 back to decimal number in SQL 2000. Is there anyway to do this? Thanks.
May 2, 2005 #2 r937 Technical User Jun 30, 2002 8,847 CA 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) Upvote 0 Downvote
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)
May 2, 2005 Thread starter #3 chaoma Technical User Apr 17, 2005 101 US Thanks. It works. Upvote 0 Downvote