码迷,mamicode.com
首页 > 数据库 > 详细

MySQL 修改int类型为bigint SQL语句拼接

时间:2020-03-25 01:56:12      阅读:271      评论:0      收藏:0      [点我收藏+]

标签:修改   def   not   default   ati   type   from   incr   sql   

SELECT
CONCAT(
"alter table ",
TABLE_SCHEMA,
".",
TABLE_NAME,
" modify ",
COLUMN_NAME,
" bigint(20)",
IF
( IS_NULLABLE = ‘NO‘, " NOT NULL", "" ),
IF
( EXTRA = "", "", " AUTO_INCREMENT" ),
IF
( COLUMN_DEFAULT IS NULL, "", CONCAT( " DEFAULT ", COLUMN_DEFAULT ) ),
IF
( COLUMN_COMMENT = "", "", CONCAT( " COMMENT ‘", COLUMN_COMMENT, "‘" ) ),
";"
) AS alter_sql
FROM
information_schema.COLUMNS
WHERE
( COLUMN_NAME = ‘orderid‘ OR COLUMN_NAME = ‘order_id‘ )
AND DATA_TYPE = ‘int‘;

MySQL 修改int类型为bigint SQL语句拼接

标签:修改   def   not   default   ati   type   from   incr   sql   

原文地址:https://www.cnblogs.com/hankyoon/p/12563259.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!