--字段查找表
select a.name, b.name from syscolumns a, sysobjects b
where lower(a.name) = '字段名'
and a.id = b.id
and b.xtype = 'u'
--知道表查存储过程
select distinct object_name(id) from syscomments where id in
(select object_id from sys.objects where type ='P') and text like'%表名%'
--根据存储过程内容查找存储过程
select b.name
from syscomments a,sysobjects b
where a.id=b.id and b.xtype='p' and a.text like '%需要查找的内容%'
---知道表查询关联的视图的存储过程
select distinct object_name(id) from syscomments
where id in (select id from sysobjects where type in('V','P'))
and text like '%表名%'