Paste / Convert BigInt to Varchar in MySQL

How can I convert BigInt to Varchar in MySQL?

+8
mysql
source share
2 answers
 mysql> select Cast (12345678901234567890 as char);
 + ------------------------------------- +
 |  Cast (12345678901234567890 as char) |
 + ------------------------------------- +
 |  12345678901234567890 | 
 + ------------------------------------- +
+11
source share

I think you cannot use varchar , try char instead. Or are you trying to change the type of an existing table field? Then you need to do, for example:

ALTER TABLE MODIFY COLUMN mycolumn varchar(50);

+4
source share

All Articles