//查询所有表名 select name from sysobjects where xtype=‘u‘
SELECT name, object_id, principal_id, schema_id, parent_object_id, type, type_desc, create_date, modify_date, is_ms_shipped, is_published,
is_schema_published, lob_data_space_id, filestream_data_space_id, max_column_id_used, lock_on_bulk_load, uses_ansi_nulls, is_replicated,
has_replication_filter, is_merge_published, is_sync_tran_subscribed, has_unchecked_assembly_data, text_in_row_limit,
large_value_types_out_of_row
FROM sys.tables
//查询数据库中所有的表名及行数
SELECT a.name, b.rows
FROM sys.sysobjects AS a INNER JOIN
sys.sysindexes AS b ON a.id = b.id
WHERE (b.indid IN (0, 1)) AND (a.type = ‘u‘)
ORDER BY a.name, b.rows DESC
//查询所有的标明及空间占用量\行数
SELECT OBJECT_NAME(id) AS tablename, 8 * reserved / 1024 AS reserved, RTRIM(8 * dpages) + ‘kb‘ AS used, 8 * (reserved - dpages) / 1024 AS unused,
8 * dpages / 1024 - rows / 1024 * minlen / 1024 AS free
FROM sys.sysindexes
WHERE (indid = 1)
ORDER BY tablename, reserved DESC