1. 程式人生 > >批量修改mysql 備註

批量修改mysql 備註

sch type where rom con 批量修改 sql orm col

SELECT
concat(
"ALTER TABLE ",
TABLE_SCHEMA,
".",
TABLE_NAME,
" CHANGE ",
COLUMN_NAME,
" ",
COLUMN_NAME,
" ",
COLUMN_TYPE,

IF (
    COLUMN_DEFAULT IS NULL,
    " ",
    concat(
        " DEFAULT ",

    IF (
        COLUMN_DEFAULT = ‘‘,
        "‘‘",
        COLUMN_DEFAULT
    )
    )
),

IF (
IS_NULLABLE = ‘NO‘,
" NOT NULL ",
‘‘
),
" COMMENT ",
" ",
"‘",
LEFT (
COLUMNS .COLUMN_NAME,
instr(COLUMNS .COLUMN_NAME, ‘F‘) - 1
),
"‘;"
)
FROM
information_schema. COLUMNS
WHERE
TABLE_NAME = ‘j_data_wa_grgz‘
AND COLUMNS .COLUMNNAME LIKE ‘%F%‘

批量修改mysql 備註