Chapter 6 PROGRAMMING SQL SERVER 2000 375 So,
Wednesday, September 23rd, 2009Chapter 6 PROGRAMMING SQL SERVER 2000 375 So, to grant a particular user permissions to read a table called MyTable, you d execute: GRANT SELECT ON MyTable TO Doug This grants Doug permission to select data from your table. If you wanted to give Doug permissions to do anything to your table short of dropping it, you could run either of these two statements: GRANT ALL ON MyTable TO Doug GRANT SELECT, INSERT, UPDATE, DELETE ON MyTable TO Doug That s nice, but you also want to let Doug give other people permissions on the table, because you ve gotten too busy. So, do something like this: GRANT ALL ON MyTable TO Doug WITH GRANT OPTION This enables Doug to grant permissions to other users on that object, up to the level of permissions that Doug has. So, if you give Doug only SELECT permissions, he can grant only SELECT permissions. Now you ve given Doug permission to change your table. That s probably not good given that Doug s boss fired him yesterday. Now what are you going to do? Good thing there s that REVOKE command. REVOKE ALL ON MyTable FROM Doug The REVOKE command works for statement permissions and object permissions, and it looks just like the GRANT statement in that you can revoke SELECT, INSERT, UPDATE, DELETE, or any combination thereof. What about revoking just the ability to grant permissions to other users? REVOKE GRANT OPTION FOR ALL ON MyTable FROM Doug That s only necessary if Doug still has permissions to access the table. But what if Doug had been giving people access to a bunch of tables he shouldn t have? You can revoke all the permissions that Doug ever granted on the table by using the CASCADE option. REVOKE GRANT OPTION FOR ALL ON MyTable FROM Doug CASCADE That s easy enough. But it would be nice to manage all these users as a group, wouldn t it?
For high quality website hosting services please check tomcat web hosting website.