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
{{ message }}
Repository navigation
Commit 642dc23
Browse filesBrowse the repository at this point in the historyBrowse files
1. Obtain a list of all dependencies on the view. Any objects, scripts, or applications that reference the view must be modified to reflect the new name of the view. For more information, see [Get Information About a View](../../relational-databases/views/get-information-about-a-view.md).
26
26
1. We recommend that you drop the view and recreate it with a new name instead of renaming the view. By recreating the view, you update the dependency information for the objects that are referenced in the view.
27
-
1. Dropping and re-creating a view will remove any granular SQL permissions that had been assigned to the view. If any permissions had been assigned specifically, you will need to GRANT the permissions to the view again. To retrieve the granular permissions granted on an object before it is dropped, see the examples in [sys.database_permissions (Transact-SQL)](../system-catalog-views/sys-database-permissions-transact-sql.md). To grant permissions, see [Grant a Permission to a Principal](../security/authentication-access/grant-a-permission-to-a-principal.md).
27
+
1. Dropping and re-creating a view will remove any granular SQL permissions assigned to the view. If any granular SQL permissions are assigned to the view, you will need to GRANT the permissions to the view again after it's re-created. To retrieve the granular permissions granted on an object before it's dropped, see the examples in [sys.database_permissions (Transact-SQL)](../system-catalog-views/sys-database-permissions-transact-sql.md). To grant permissions, see [Grant a Permission to a Principal](../security/authentication-access/grant-a-permission-to-a-principal.md).
While you can use `sp_rename` to change the name of the view, we recommend that you delete the existing view and then re-create it with the new name.
46
+
While you can use `sp_rename` to change the name of the view, we recommend that you delete the existing view, and then re-create it with the new name.
47
47
48
-
This is because renaming a stored procedure, function, view, or trigger doesn't change the name of the corresponding object in the definition column of the [sys.sql_modules](../system-catalog-views/sys-sql-modules-transact-sql.md) catalog view, leading to future confusion. Therefore, we recommend that`sp_rename`not be used to rename these object types. Instead, drop and re-create the object with its new name.
48
+
When you rename a stored procedure, function, view, or trigger with `sp_rename`, the name of the corresponding object doesn't change in the definition column of the [sys.sql_modules](../system-catalog-views/sys-sql-modules-transact-sql.md) catalog view. This can lead to future confusion. Therefore, we don't recommend using`sp_rename` to rename objects. Instead, drop and re-create the object with its new name.
49
49
50
50
For example:
51
51
@@ -64,4 +64,4 @@ This is because renaming a stored procedure, function, view, or trigger doesn't
64
64
## <aid="FollowUp"></a> Follow up: after renaming a view
65
65
66
66
1. Ensure that all objects, scripts, and applications that reference the view's old name now use the new name.
67
-
1. Dropping and re-creating a view will remove any granular SQL permissions that had been assigned to the view. If any permissions had been assigned specifically, you will need to GRANT the permissions to the view again. To retrieve the granular permissions granted on an object before it is dropped, see the examples in [sys.database_permissions (Transact-SQL)](../system-catalog-views/sys-database-permissions-transact-sql.md). To grant permissions, see [Grant a Permission to a Principal](../security/authentication-access/grant-a-permission-to-a-principal.md).
67
+
1. Dropping and re-creating a view will remove any granular SQL permissions assigned to the view. If any granular SQL permissions are assigned to the view, you'll need to GRANT the permissions to the view again when it's re-created. To retrieve the granular permissions granted on an object before it's dropped, see the examples in [sys.database_permissions (Transact-SQL)](../system-catalog-views/sys-database-permissions-transact-sql.md). To grant permissions, see [Grant a Permission to a Principal](../security/authentication-access/grant-a-permission-to-a-principal.md).
0 commit comments