各种工具都有,没有特别趁手的。不如自己用sql处理。
SELECT column_name AS CODE, CASE WHEN column_comment IS NULL OR TRIM(column_comment)='' THEN column_name ELSE CASE WHEN INSTR(column_comment,'-')>0 THEN SUBSTR(column_comment,1,INSTR(column_comment,'-')-1) WHEN INSTR(column_comment,'(')>0 THEN SUBSTR(column_comment,1,INSTR(column_comment,'(')-1) WHEN INSTR(column_comment,'(')>0 THEN SUBSTR(column_comment,1,INSTR(column_comment,'(')-1) WHEN INSTR(column_comment,';')>0 THEN SUBSTR(column_comment,1,INSTR(column_comment,';')-1) WHEN INSTR(column_comment,'|')>0 THEN SUBSTR(column_comment,1,INSTR(column_comment,'|')-1) WHEN INSTR(column_comment,' ')>0 THEN SUBSTR(column_comment,1,INSTR(column_comment,' ')-1) WHEN INSTR(column_comment,',')>0 THEN SUBSTR(column_comment,1,INSTR(column_comment,',')-1) ELSE column_comment END END AS column_name , column_type, column_comment ,is_nullable FROM information_schema.columns WHERE table_name='xxxx' AND table_schema='xxx' ORDER BY ordinal_position
执行效果如下: