1、MSSQL Server
表:selectCOUNT(*)fromdbo.sysobjectsWHEREname='table_name';
字段:selectCOUNT(*)fromsyscolumnsWHEREid=object_id(‘table_name’)andname='column_name';
2、My SQL
表:selectCOUNT(*)frominformation_schema.tablesWHEREtable_name ='table_name';
字段:selectCOUNT(*)frominformation_schema.columnsWHEREtable_name ='table_name'andcolumn_name ='column_name';
3、Oracle
表:SELECTcount(*)FROMUSER_OBJECTSWHEREOBJECT_NAME ='table_name';
字段:SELECTCOUNT(*)FROMUSER_TAB_COLUMNSWHERETABLE_NAME ='table_name'andcolumn_name ='column_name';
4、PostgreSql
表:selectcount(*)frominformation_schema.tablesWHEREtable_schema='table_schema'andtable_name ='table_name';
字段:selectcount(*)frominformation_schema.columnsWHEREtable_schema='table_schema'andtable_name ='table_name'andcolumn_name='column_name';