SQL Server Error 1037 occurs when you attempt to revoke a permission from a user or role that was granted using the WITH GRANT OPTION, but you fail to include the CASCADE keyword in your statement. To fix this, you must add the CASCADE keyword to your REVOKE command, which tells SQL Server to automatically revoke the permission from all other users who received that permission from the user you are currently targeting.
In SQL Server, the WITH GRANT OPTION allows a user to not only hold a permission but also delegate that same permission to others. This creates a chain of dependency. If you try to remove the permission from the person at the top of that chain without specifying how to handle the people further down the line, SQL Server blocks the action to prevent "orphaned" permissions. Using CASCADE ensures that the entire chain of delegated permissions is cleaned up simultaneously, maintaining the security integrity of the database.
What You'll Need
- SQL Server Management Studio (SSMS) or another SQL query editor.
- A login with administrative privileges (such as sysadmin or securityadmin) to modify permissions.
- The name of the user or role whose permissions are being revoked.
- The specific permission (e.g., SELECT, UPDATE, EXECUTE) and the object (e.g., a table or view) involved.
Step-by-Step
- Identify the Dependency Chain: Before running a destructive command, determine who else has been granted permissions by the user in question. You can use the system catalog views to find these dependencies. Run a query against
sys.database_permissionsand join it withsys.database_principalsto see thegrantor_principal_id. This helps you understand exactly which users will lose access when you apply the CASCADE command. - Draft the Basic Revoke Statement: Start with a standard revoke command. For example, if you are trying to remove SELECT permissions on a table named "SalesData" from a user named "MarketingUser", your initial (and failing) command would look like:
REVOKE SELECT ON SalesData FROM MarketingUser;. When you run this, you will encounter Error 1037 because "MarketingUser" likely granted that permission to others. - Apply the CASCADE Keyword: Modify your statement to include the CASCADE clause. The correct syntax is:
REVOKE SELECT ON SalesData FROM MarketingUser CASCADE;. By adding CASCADE at the end, you instruct SQL Server to find every user who received the SELECT permission from "MarketingUser" and revoke it from them as well. - Execute the Command: Run the modified query in your SQL editor. If the command is successful, SQL Server will return a message indicating that the command completed successfully.
- Verify the Results: Confirm that the permissions have been removed not only from the primary user but also from the secondary users. You can do this by attempting to access the object using one of the delegated accounts or by querying the
sys.database_permissionsview again to ensure the entries for those users have been deleted. - Re-grant Permissions (If Necessary): In many cases, the users who were revoked via CASCADE still actually need access to the data. Since the chain was broken, you must now grant those permissions directly from a high-level administrator account rather than through the intermediary user. Use the
GRANTcommand for each affected user individually.
Common Mistakes
One of the most frequent mistakes is attempting to manually revoke permissions from every single sub-user before revoking from the primary grantor. While this logically seems like it would work, it is time-consuming and prone to error, especially in complex environments with dozens of users. The CASCADE keyword is designed specifically to replace this manual process.
Another common error is confusing REVOKE with DENY. A REVOKE removes a previously granted permission, returning the user to a neutral state. A DENY explicitly forbids the user from performing the action, which overrides any other grants they might have from other roles. If you use DENY instead of REVOKE CASCADE, you may not solve the dependency issue, and you might accidentally block a user who should still have access via a different permission path.
Some administrators also forget to check the object type. The CASCADE syntax remains consistent, but the object specification (e.g., ON SCHEMA::dbo vs ON OBJECT::SalesData) must be precise. If the permission was granted at the schema level, revoking it at the table level will not trigger the same dependency logic and may leave the user with more access than intended.
Tips
To avoid Error 1037 in the future, avoid using the WITH GRANT OPTION unless it is absolutely necessary for your organizational structure. It is generally a better security practice to have a single administrative account or a dedicated security role handle all permission grants. This prevents the creation of complex dependency chains that make auditing and revoking permissions difficult.
Always perform a backup of your permission settings before performing a mass revoke. You can do this by scripting out the current permissions of your database users. In SSMS, you can right-click the database, go to Tasks, and use the Generate Scripts wizard to script the permissions. This ensures that if you accidentally revoke access from a critical service account via CASCADE, you can restore that access immediately.
When managing permissions for large teams, use Database Roles. Instead of granting permissions to individual users with the grant option, create a role (e.g., "SalesReportsRole"), grant the necessary permissions to that role, and then add users to the role. Since roles do not typically delegate permissions in the same way individuals do with the grant option, you avoid the risk of Error 1037 entirely.
Troubleshooting
If you apply the CASCADE keyword and still receive an error, check if the user you are revoking from is actually the grantor. If the permission was granted by a different administrator, the CASCADE command will not find a chain to follow and may behave unexpectedly or fail if the syntax is slightly off. Ensure you are targeting the specific user who used the WITH GRANT OPTION.
If the command executes but users still have access, check for overlapping permissions. A user might have been granted access by two different people. If you revoke from Grantor A using CASCADE, the user will still have access because Grantor B also gave them permission. You will need to identify all grantors for that specific user to fully remove their access.
In rare cases, system-level locks can prevent the revocation of permissions. If the command hangs, check for active sessions that are currently using the object in question. While a REVOKE usually doesn't require an exclusive lock on the data itself, heavy system activity or deadlocks in the system catalogs can occasionally cause delays. Restarting the SQL Server service is a last resort, but usually, killing the blocking process via the Activity Monitor is sufficient.
Frequently Asked Questions
What exactly does the CASCADE keyword do?
CASCADE tells SQL Server to follow the trail of permissions. If User A granted a permission to User B, and User B granted it to User C, revoking from User B with CASCADE will automatically remove the permission from User C as well.
Can I revoke permissions without using CASCADE?
Only if the user you are revoking from has not granted those permissions to anyone else. If they have used the WITH GRANT OPTION to delegate access, SQL Server requires CASCADE to ensure no orphaned permissions remain.
Will CASCADE delete the user account?
No. The CASCADE keyword only affects the specific permission being revoked. It does not delete the user account, their login, or any other permissions they may hold on other objects.
Is there a way to see who granted a permission?
Yes, you can query the sys.database_permissions view. The grantor_principal_id column identifies the user who granted the permission, which you can then link to sys.database_principals to get the actual username.
Does this error happen with the DENY command?
No, Error 1037 is specific to the REVOKE command. DENY is an explicit override and does not follow the same grantor-grantee chain logic as REVOKE.