Mysql database:
select COLUMN_NAME, DATA_TYPE from information_schema.COLUMNS where table_name ='mytable'
Oracle database:
select column_name, data_type from all_tab_columns where TABLE_NAME ='mytable'
SQLServer database
select column_name,data_type from information_schema.columns where table_name ='mytable'
Postgresql database
select column_name, data_type from information_schema.columns where table_name = 'mytable' ORDER BY ordinal_position;
原地址:https://www.2cto.com/database/201610/555778.html