您好,欢迎访问一九零五行业门户网

如何快速重新编译所有的存储过程

自己的一个写法,大概思路是从sys.objects里取得所有的存储过程,然后拼动态字符串来使用sp_recompile重新编译所有的sp。 select row_number() over(order by name) as rid,exec sp_recompile + name + as textinto #tempfrom sys.objects where type = pdec
自己的一个写法,大概思路是从sys.objects里取得所有的存储过程,然后拼动态字符串来使用sp_recompile重新编译所有的sp。
select row_number() over(order by name) as rid,'exec sp_recompile ''' + name +'''' as textinto #tempfrom sys.objects where type = 'p'declare @maxid intdeclare @sql varchar(max)select @maxid = max(rid) from #tempwhile (@maxid is not null)begin select @sql = text from #temp where rid = @maxid --print @sql exec (@sql) select @maxid = max(rid) from #temp where rid < @maxid end
不知道还有没有什么更好的方法。
其它类似信息

推荐信息