--方法一:
declare @s nvarchar(2000)
declare tb cursor local for
select 'exec sp_refreshview ' +name
from sysobjects
where xtype= 'v ' and status> =0
open tb
fetch next from tb into @s
while @@fetch_status=0
begin
exec(@s)
fetch next from tb into @s
end
close tb
deallocate tb
--方法二:
declare @a varchar(8000)
select @a=isnull(@a+ ';'+char(13), '')+ 'exec sp_refreshview '+ name
from sysobjects
where xtype= 'v' and status >= 0
--from information_schema.view_table_usage where table_name= '改动的表名 '
exec(@a)