create procedure sp_rebuildallview
as
begin

declare @mytext varchar(8000)
declare @id int
declare mycursor cursor for

select c.text from dbo.syscomments c,
 dbo.sysobjects o     where o.id = c.id
and o.type = 'v'
order by c.number, c.colid

open mycursor
fetch next from mycursor into @mytext
while @@fetch_status =0
begin
  set @id = patindex('%create%', @mytext)
 
  set @mytext = stuff(@mytext, @id, 6, 'Alter')
  print @mytext
  exec(@mytext)
  fetch next from mycursor into @mytext
end
close mycursor
deallocate mycursor
end

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-06-24
  • 2022-01-16
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-01-10
  • 2021-07-14
  • 2022-12-23
  • 2021-10-11
  • 2022-01-17
  • 2021-11-01
相关资源
相似解决方案