You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/relational-databases/system-stored-procedures/sp-refreshview-transact-sql.md
+7-6Lines changed: 7 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,7 +4,7 @@ description: sp_refreshview updates the metadata for the specified non-schema-bo
4
4
author: markingmyname
5
5
ms.author: maghan
6
6
ms.reviewer: randolphwest
7
-
ms.date: 06/23/2025
7
+
ms.date: 11/20/2025
8
8
ms.service: sql
9
9
ms.subservice: system-objects
10
10
ms.topic: "reference"
@@ -46,20 +46,22 @@ The name of the view. *@viewname* is **nvarchar**, with no default. *@viewname*
46
46
47
47
## Remarks
48
48
49
-
If a view isn't created with SCHEMABINDING, `sp_refreshview` should be run when changes are made to the objects underlying the view, which affect the definition of the view. Otherwise, the view might produce unexpected results when it's queried.
49
+
If a view isn't created with `SCHEMABINDING`, `sp_refreshview` should be run when changes are made to the objects underlying the view, which affects the definition of the view. Otherwise, the view could produce unexpected results when you query it.
50
50
51
51
## Permissions
52
52
53
-
Requires ALTER permission on the view and REFERENCES permission on common language runtime (CLR) user-defined types and XML schema collections that are referenced by the view columns.
53
+
Requires `ALTER` permission on the view, and `REFERENCES` permission on common language runtime (CLR) user-defined types and XML schema collections that the view columns reference.
Assume that the table `Person.Person` was changed in a way that would affect the definition of any views that are created on it. The following example creates a script that refreshes the metadata for all views that have a dependency on table `Person.Person`.
71
73
72
74
```sql
73
-
USE AdventureWorks2022;
75
+
USE AdventureWorks2025;
74
76
GO
75
77
76
78
SELECT DISTINCT'EXECUTE sp_refreshview '''+ name +''''
0 commit comments