查询表:

select * from sys.objects where type='U'


查询存储过程

select * from sys.objects where type='P'

查询存储过程的内容

EXEC Sp_HelpText  '存储过程name'


查询自定义函数
select * from dbo.sysobjects  WHERE xtype='AF'

查询自定义函数的内容

EXEC Sp_HelpText  '自定义函数name'




还有其他的类型  可这样查看

select xtype from dbo.sysobjects  GROUP BY xtype

 

也可以用select * from sys.sql_modules查看内容