Excel to MySQL dec2hex -
I need help in swapping Excel formulas in the MySQL formula.
I have the following number which will be in the column called DEC = 005341009450614
I have to break it into three parts and make DEC2HEX conversions on each and insert the result. I can do this in Excel:
= CONCATENATE (DEC2HEX (MID (A1,1,5), 4), DEC2HEX (MID (A1,6,2), 2), DEC2HEX (MID ( A1, 8,8), 6))
My question is how can I repeat this in MySQL?
I have tried:
SELECT CONCAT (hex (SUBSTRING (`DEC`, 1,5)), hex (SUBSTRING (` DEC`, 6,2) but it gives me "303032373830373039343430333437"
where the result should be Should:
"02160A903476"
Thank you for your help!
In MySQL, just change the hex to any integer, simply HEX Function: SELECT HEX (& lt; number & gt;); The input parameter is a BIGINT or a string, so that it is enough for a large number.
Comments
Post a Comment