Created
July 20, 2020 10:16
-
-
Save huobazi/325354732eacae7d43d2ccadba66c30e to your computer and use it in GitHub Desktop.
dirty-magic-on-how-to-convert-bigint-to-int-in-mysql
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
ref: https://stackoverflow.com/questions/11595217/convert-bigint-unsigned-to-int#11595484 | |
*/ | |
/* | |
CREATE FUNCTION long2int (n BIGINT) RETURNS INT(11) RETURN n; | |
*/ | |
SET @a:= CAST('111' AS SIGNED ); | |
DROP TEMPORARY TABLE IF EXISTS foo; | |
CREATE TEMPORARY TABLE foo SELECT long2int(@a); -- dirty magic | |
DESC foo; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment