SQL Clone
SQLServerCentral is supported by Redgate
Log in  ::  Register  ::  Not logged in

Get your favorite SSC scripts directly in SSMS with the free SQL Scripts addin. Search for scripts directly from SSMS, and instantly access any saved scripts in your SSC briefcase from the favorites tab.
Download now (direct download link)

Refresh all views in a database

By S M,

Assume that the tables in a database are changed in a way that would affect the definition of any views that are created on it. To help solve this, you will need to refresh the views in the database.

If you have a requirement to refresh all the views in a database, use the script. Change the database name at the top with your required database name and run the script. It should work.

Also if you have any requirement to refresh all views in all the databases, then use a cursor and run through the script. Fairly simple!!!

Total article views: 749 | Views in the last 30 days: 16
Related Articles

Database Refresh

Database Refresh


PowerShell – SQL Database Refresh -Restore – Multiple Databases

.SYNOPSIS The purpose of the script is to restore database/s from a database backup. The requiremen...


Refreshing Availability Group Database with PowerShell

Following last weeks post on Refreshing A Mirrored Database with PowerShell I thought I would write ...


Copy/Refresh a database in the night

Refresh a report database with this script.


Database Refresh Sync

Sync users and roles after restore/refresh