批量生产改表名的脚本

SELECT
    CASE
WHEN TABLE_NAME NOT IN (
    'T_CITY',
    'T_CV_EDUCATION_EXPERIENCE',
    'T_CV_JOB_INTENTION',
    'T_CV_LANGUAGE_ABILITY',
    'T_CV_PRODUCT',
    'T_CV_PROJECT_EXPERIENCE',
    'T_CV_REMARK',
    'T_CV_RESUME_INFO',
    'T_CV_RESUME_REPEAT_HANDLE_RECORD',
    'T_CV_RESUME_UPDATE_HISTORY',
    'T_CV_SEQUENCE',
    'T_CV_TRAINING_EXPERIENCE',
    'T_CV_WORK_EXPERIENCE',
    'T_CV_WORK_TAGS',
    'T_DICTIONARY_MAPPING',
    'T_JOBHUNTER_EDUCATION_EXPERIENCE',
    'T_JOBHUNTER_JOB_INTENTION',
    'T_JOBHUNTER_LANGUAGE_ABILITY',
    'T_JOBHUNTER_PROJECT_EXPERIENCE',
    'T_JOBHUNTER_RESUME_INFO',
    'T_JOBHUNTER_RESUME_PRODUCT',
    'T_JOBHUNTER_TRAINING_EXPERIENCE',
    'T_JOBHUNTER_WORK_EXPERIENCE',
    'T_RESUME',
    'T_RESUME_AUTHORIZED',
    'T_RESUME_BACKGROUND_ATTACHMENT',
    'T_RESUME_BACKGROUND_BUSINESS',
    'T_RESUME_BACKGROUND_FINANCE',
    'T_RESUME_BACKGROUND_OBJECTIVE',
    'T_RESUME_BACKGROUND_RESULT',
    'T_RESUME_BACKGROUND_SKILL',
    'T_RESUME_BACKGROUND_SURVEY',
    'T_RESUME_EDUCATION_BACKGROUND',
    'T_RESUME_EDUCATION_BG_RESPONDENT',
    'T_RESUME_RECOMMEND_CONFORM',
    'T_RESUME_REPORT',
    'T_RESUME_WORK_BACKGROUND',
    'T_RESUME_WORK_BG_RESPONDENT',
    'T_SUPPLIERS_INFO',
    'T_SUPPLIERS_LOCK_HISTORY',
    'T_SUPPLIERS_QIAODA_RESUME_HISTORY',
    'T_SUPPLIERS_RESUME_HISTORY',
    'T_VERSION_CV_EDUCATION_EXPERIENCE',
    'T_VERSION_CV_JOB_INTENTION',
    'T_VERSION_CV_LANGUAGE_ABILITY',
    'T_VERSION_CV_PRODUCT',
    'T_VERSION_CV_PROJECT_EXPERIENCE',
    'T_VERSION_CV_RESUME_INFO',
    'T_VERSION_CV_TRAINING_EXPERIENCE',
    'T_VERSION_CV_WORK_EXPERIENCE',
    'T_VERSION_RESUME_BACKGROUND_SURVEY',
    'T_VERSION_RESUME_EDUCATION_BACKGROUND',
    'T_VERSION_RESUME_REPORT',
    'T_VERSION_RESUME_WORK_BACKGROUND',
    'T_VERSION_RESUME_WORK_BG_RESPONDENT',
    'V_CUSTOM_MENU',
    'view_company'
) THEN
    CONCAT(
        'ALTER TABLE ',
        table_name,
        ' RENAME TO SH_',
        table_name,
        ';'
    )
ELSE
    NULL
END AS sql_command
FROM
    information_schema. TABLES
WHERE
    TABLE_SCHEMA = 'lieni'

 

posted @ 2019-03-14 18:32  LTmei  阅读(256)  评论(0编辑  收藏  举报