CAST() seems to only work for BINARY,CHAR,DATE;DATETIME,DECIMAL,TIME,SIGNED,UNSIGNED.
I need to convert a hex string to a bigint, that is, I’d want:
SELECT CAST(CONV("55244A5562C5566354',16,10) AS BIGINT)
CONV() returns a string, so that’s why I’m trying the convert it. I have 2 uses for this
-
Inserting data, e.g.
INSERT INTO a(foo) SELECT CONV(bar,16,10) FROM ...Here foo is a bigint column, bar a varchar. Perhaps I could get away with the select statement being a string and let MySQL take care of it (?) -
Returning data where the client will dynamically learn the data type of the column,
SELECT CONV(bar,16,10)is no good as the client will handle it as a string.
1 Answer