存储过程包含
select name
from sysobjects o, syscomments s
where o.id = s.id
and text like '%请输入你要查询的内容%'
and o.xtype = 'P'
表包含
SELECT t.name AS table_name,
c.name AS column_name
FROM sys.tables AS t
INNER JOIN sys.columns c ON t.OBJECT_ID = c.OBJECT_ID
WHERE c.name LIKE'%请输入你要查询的内容%'
视图包含
select name,case when o.xtype = 'V' then '视图' when o.xtype = 'P' then '存储过程' when o.xtype = 'T' then '表' else '其他' end as '类型'
from sysobjects o, syscomments s
where o.id = s.id
and text like '%请输入你要查询的内容%'
and o.xtype IN( 'V','P','T') ORDER BY 类型
网友评论