1.oracle
sql = "SELECT column_name, data_type, data_length, nullable";
sql += " FROM user_tab_columns ";
sql += " where table_name='";
sql += $tableName;
sql += "'";
select * From user_tab_comments 查询表名及表说明(comment)
select * from user_col_comments 查询表及表中字段的说明
2.sql server
select name,xtype,length,isnullable from syscolumns
where id =(select top 1 Id from sysobjects where name = '表名');
sql = "select name,xtype,length,isnullable from syscolumns where id =";
sql += " (select top 1 Id from sysobjects where name = '";
sql += $tableName;
sql += "')";
3.my sql
sql = "show columns from ";
sql += $tableName;
或
sql = "desc ";
sql += $tableName;
或
sql = "describe ";
sql += $tableName;