SELECT ORDINAL_POSITION AS Colorder, Column_Name AS ColumnName, data_type AS TypeName, COLUMN_COMMENT AS DeText, ( CASE WHEN data_type = 'float' OR data_type = 'double' OR data_type = 'decimal' THEN NUMERIC_PRECISION ELSE CHARACTER_MAXIMUM_LENGTH END ) AS length, NUMERIC_SCALE AS Scale, ( CASE WHEN EXTRA = 'auto_increment' THEN 1 ELSE 0 END ) AS IsIdentity, ( CASE WHEN COLUMN_KEY = 'PRI' THEN 1 ELSE 0 END ) AS IsPK, ( CASE WHEN IS_NULLABLE = 'NO' THEN 0 ELSE 1 END ) AS CanNull, extra, COLUMN_DEFAULT AS DefaultVal FROM information_schema. COLUMNS