|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?注册账号
×
--查找存储过程、函数中使用的字段及库表等
declare @id int
declare @procCounts int
declare @key varchar(30)
declare @procname char(60)
set @id=1
set @key='spkfk'
create table #procList
(id int,
procName char(60)
)
create table #procText
(procname char(60),
sqls varchar(1000)
)
insert into #procList
select ROW_NUMBER() over(order by name) id, name as procName
from sys.objects where type in ('P','FN') and is_ms_shipped=0
select @procCounts=count(id) from #procList
while @id<@procCounts
begin
select @procname=procname from #procList where id=@id
insert into #procText
(sqls)
exec sp_helptext @procname
update #proctext set procname=@procname where procname is null
set @id=@id+1
end;
select distinct rtrim(procname)
from #proctext
where sqls like '%'+@key+'%'
drop table #proctext
drop table #procList |
|