Professional Documents
Culture Documents
With Grant Option: Cascade
With Grant Option: Cascade
CASCADE
The challenge of the WITH GRANT OPTION clause comes when you need to REVOKE or DENY the
permission that you granted to James using the WITH GRANT OPTION. You do not know which other
users James has already granted the permission to.
When revoking or denying a permission, you can use the CASCADE clause to also revoke or deny
permissions from any users who had been granted them by User1.
In this example, the REVOKE statement will fail if you omit the CASCADE clause, because the GRANT
statement included the WITH GRANT OPTION clause.
Demonstration Steps
1. Ensure that the MT17B-WS2016-NAT, 20764C-MIA-DC, and MIA20764C-MIA-SQL virtual
machines are running, and log on to 20764C-MIA-SQL as ADVENTUREWORKS\Student with the
password Pa55w.rd.
8. Execute the code under the heading for Step 1 to create a user for the demonstration.
9. Execute the code under the heading for Step 2 to query the list of server principals. Note
Mod03Login at the end of the list.
10. Execute the code under the heading for Step 3 to query the list of database principals. Again, note
Mod03Login in the list.
11. Execute the code under the heading for Step 4 to grant SELECT permissions on the Product table to
Mod03Login.
12. Execute the code under the heading for Step 5 to change the execution context.
13. Execute the code under the heading for Step 6 to test the permissions. Note that you can select from
the Product table that you were granted permissions on, but not from the ProductInventory table.
14. Execute the code under the heading for Step 7 to revert the execution context.
15. Execute the code under the heading for Step 8 to grant SELECT permissions on specific columns in
the ProductInventory table to Mod03Login.
16. Execute the code under the heading for Step 9 to change the execution context.
17. Execute the code under the heading for Step 10 to test the permissions. Note that the first query to
select the two specific columns executes, but you cannot select all the columns from the
ProductInventory table.
18. Execute the code under the heading for Step 11 to revert the execution context.
19. On the File menu, click Close.
20. Leave SQL Server Management Studio open for the next demonstration.