-- 1.查询 Sql Server 某个库的所有 存储过程/视图/函数/触发器 的名称及相关信息 --(非加密对象可直接查看代码) SELECT sm.object_id AS 实体对象ID , OBJECT_NAME(sm.object_id) AS 对象名称 , o.type AS 对象类型 , o.type_desc AS 类型描述 , sm.definition AS 具体代码 FROM sys.sql_modules AS sm JOIN sys.objects AS o ON sm.object_id = o.object_id where o.type='P' ORDER BY OBJECT_NAME(sm.object_id); --其中 o.type的值可以是: -- P---->存储过程 -- FN--->函数 -- V--->视图 -- TR-->触发器 -- 2.查询 Sql Server某个库的所有表名和行数 select a.name 表名, b.rows 行数 from sysobjects as a inner join sysindexes as b on a.id = b.id where (a.type = 'u') and (b.indid in (0, 1)) order by a.name ;