How might I Cast/Convert BigInt to Varchar in MySQL?
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
mysql> select Cast( 12345678901234567890 as char) ; +-------------------------------------+ | Cast( 12345678901234567890 as char) | +-------------------------------------+ | 12345678901234567890 | +-------------------------------------+
回答2:
I think you can't cast to varchar, try char instead. Or are you trying to modify the type of an existing field of a table? Then you have to do for example:
ALTER TABLE MODIFY COLUMN mycolumn varchar(50);