• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 512
  • Last Modified:

Conversion of Hex number to decimal format

I need to convert a Hexidecimal number (0107017ee440be56) to a decimal format using SQL.  This has to be done during a loop.  Is there any easy way to do this?
0
blberger
Asked:
blberger
  • 5
  • 2
  • 2
  • +2
1 Solution
 
Aneesh RetnakaranDatabase AdministratorCommented:
SELECT CAST(0x0107017ee440be56 AS BIGINT)  -- prefix a  '0x' and then do a cast
0
 
Racim BOUDJAKDJIDatabase Architect - Dba - Data ScientistCommented:
<<SELECT CAST(0x0107017ee440be56 AS BIGINT)  -- prefix a  '0x' and then do a cast>>
Hey that's a cute solution...Thanks...
0
 
dbbishopCommented:
Racimo: looks like more than one person learned something today. Think you and I can give aneeshattingal some points?
0
Get quick recovery of individual SharePoint items

Free tool – Veeam Explorer for Microsoft SharePoint, enables fast, easy restores of SharePoint sites, documents, libraries and lists — all with no agents to manage and no additional licenses to buy.

 
Racim BOUDJAKDJIDatabase Architect - Dba - Data ScientistCommented:
<<Racimo: looks like more than one person learned something today. Think you and I can give aneeshattingal some points?>>
I particularly like the elegance of the solution...(simple and easy)

I'd be glad to give some poinks but I am afraid the only way to do that would be to create a fake question and attribute poinks without rela answer.   I am not sure about what EE's guideline say about that...
0
 
Racim BOUDJAKDJIDatabase Architect - Dba - Data ScientistCommented:
In other words..It's good to learn something about SQL once in a blue moon...
0
 
Aneesh RetnakaranDatabase AdministratorCommented:
>It's good to learn something about SQL once in a blue moon.
as far as I am concerned, from ee, i am learning at least one thing per day, and we are here to help others and learn something new;  I am glad that I helped you guys in this.  :)
0
 
Racim BOUDJAKDJIDatabase Architect - Dba - Data ScientistCommented:
<<as far as I am concerned, from ee, i am learning at least one thing per day>>
Lucky you...

<<I am glad that I helped you guys in this>>
I particularly like little tricks and this is one of them...I wish I could pay you back with a few I am aware of...

Anyway that's the kind of thread and spirit that make me like EE...
;)
0
 
dbbishopCommented:
I went from application developer to database developer almost overnight three months ago and if it weren't for EE, I'd have been on the streets 2-1/2 months ago :-)
0
 
Anthony PerkinsCommented:
As developers we are all missing the requirements:
"This has to be done during a loop."

So here you go:

Declare @Loop integer

Set @Loop = 0
While @Loop < 1000000
    Set @Loop = @Loop + 1

-- Now we can apply Aneesh's solution:
SELECT CAST(0x0107017ee440be56 AS BIGINT)
0
 
Racim BOUDJAKDJIDatabase Architect - Dba - Data ScientistCommented:
<offtopic moment of delirium>
<<As developers we are all missing the requirements:>>
Common!!! Antony you are spoiling the fun !!!! LOL...!!!
</<offtopic moment of delirium>>
0
 
Computer101Commented:
Forced accept.

Computer101
EE Admin
0

Featured Post

NFR key for Veeam Backup for Microsoft Office 365

Veeam is happy to provide a free NFR license (for 1 year, up to 10 users). This license allows for the non‑production use of Veeam Backup for Microsoft Office 365 in your home lab without any feature limitations.

  • 5
  • 2
  • 2
  • +2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now