SELECT DISTINCT
TOP 100 PERCENT isnull(p.name,'') AS 父对象, o.xtype, CASE o.xtype WHEN 'C' THEN 'CHECK 约束' WHEN 'D' THEN '默认值或DEFAULT约束' WHEN 'F' THEN 'FOREIGNKEY约束' WHEN 'L' THEN '日志' WHEN 'FN' THEN '标量函数' WHEN 'IF' THEN '内嵌表函数' WHEN 'P' THEN '存储过程' WHEN 'PK' THEN 'PRIMARYKEY约束' WHEN 'RF' THEN '复制筛选存储过程' WHEN 'S' THEN '系统表' WHEN 'TF' THEN '表函数' WHEN 'TR' THEN '触发器' WHEN 'U' THEN '用户表' WHEN 'UQ' THEN 'UNIQUE 约束' WHEN 'V' THEN '视图' WHEN 'X' THEN '扩展存储过程' WHEN 'R' THEN '规则' ELSE NULL END AS 类型, o.name AS 对象名, o.crdate AS 创建时间, o.refdate AS 更改时间, c.text AS 声明语句,OBJECTPROPERTY(o.id, N'IsMSShipped')FROM dbo.sysobjects o Left JOIN dbo.sysobjects p ON o.parent_obj = p.id LEFT OUTER JOIN dbo.syscomments c ON o.id = c.idWHERE --(o.xtype IN ('C','D','F','PK','UQ','L','FN','IF','TF','TR','P','R','RF','X','S','U','V')) AND (OBJECTPROPERTY(o.id, N'IsMSShipped') = 0) AND (isnull(p.name,'') <> N'dtproperties')ORDER BY o.xtype DESC