Technical Article

SQL Server All View Refresh

,

run the script I prepared to update all the views in the database.

Yusuf KAHVECI

yusufkahveci@sqlturkiye.com

www.sqlturkiye.com

Thanks

USE <Database_Name>
GO
DECLARE @sqlTrexec NVARCHAR(MAX)=''
SELECT @sqlTrexec = @sqlTrexec + 'EXEC sp_refreshview ''' + name + '''; 
'
FROM sys.objects AS syso
WHERE syso.type='V'
EXEC (@sqlTrexec)
--SELECT @sqlTrexec

Rate

2.5 (4)

You rated this post out of 5. Change rating

Share

Share

Rate

2.5 (4)

You rated this post out of 5. Change rating