SQL查看數據庫中包含臨時表的所有存儲過程

使用遊標過濾包含#開頭的存儲過程


declare @name varchar(300)

declare mycur cursor for
    select name from sysobjects o,syscomments s
    where o.id = s.id and o.xtype ='p' and text like '%#%' and o.xtypr = 'P'
open mycur
fetch next from mycur into @name
while @@FETCH_STATUS = 0
begin
    exec('exec sp_helptext ' + @name)
    fetch next from mycur into @name
end
close mycur
deallocate mycur
go
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章