【备忘】获取msyql字段类型
作者:互联网
SELECT
COLUMN_NAME F_FIELD,
data_type F_DATATYPE,
CHARACTER_MAXIMUM_LENGTH F_DATALENGTH,
NUMERIC_PRECISION 精度,
NUMERIC_SCALE 小数位数,
IF
( IS_NULLABLE = 'YES', '1', '0' ) F_ALLOWNULL,
COLUMN_COMMENT F_FIELDNAME,
IF
( COLUMN_KEY = 'PRI', '1', '0' ) F_PRIMARYKEY,
column_default F_DEFAULTS,
CONCAT( upper( COLUMN_NAME ), '(', COLUMN_COMMENT, ')' ) AS 'F_DESCRIPTION'
FROM
INFORMATION_SCHEMA.COLUMNS
WHERE
TABLE_NAME = '表名'
AND TABLE_SCHEMA = '库名'
END
标签:COMMENT,NAME,COLUMN,NUMERIC,备忘,字段,msyql,TABLE,SCHEMA 来源: https://blog.csdn.net/qq_15941409/article/details/121698622