Technical Article

Refresh views

,

This script will refresh all user views that exist in a user database.

-- Script to refresh the views
-- Written by: Wali A. Ali, 2004
-- shareware....

select  'exec sp_refreshview '+ '"'+ quotename(user_name(u.uid))+'.'+quotename(o.name)+'"' 
FROM sysusers AS u INNER JOIN sysobjects AS o
on   u.uid = o.uid
  where objectproperty(id,N'IsView')=1 
  and objectproperty(id,N'IsMSShipped') = 0

Rate

Share

Share

Rate