重整所有視表。
sp_refreshview [msdn]

CREATE PROCEDURE [up_RefreshView] AS
DECLARE @ViewName sysname

DECLARE curView CURSOR  FOR
    SELECT TABLE_NAME
    FROM [INFORMATION_SCHEMA].[TABLES]
    WHERE TABLE_TYPE='VIEW' AND [TABLE_SCHEMA]<>'INFORMATION_SCHEMA' AND SUBSTRING(TABLE_NAME,1,3)!='sys'

OPEN curView FETCH curView INTO @ViewName

WHILE @@FETCH_STATUS = 0
    BEGIN -- WHILE
        print @ViewName
        exec sp_refreshview @ViewName
        FETCH curView INTO @ViewName
    END -- WHILE

CLOSE curView
DEALLOCATE curView