Click here to Skip to main content
16,018,534 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi.

I'm using sql-server 2005;

there is a DB and a Table in it named myTB,
there are two users named user1 and user2.

user2 can log in and set some permissions, for example he can execute the query bellow:

DENY permission ON myTB TO user1. or GRANT permission ...

Now the problem is that I want to restrict user2 ! I mean that user2 shouldn't have the permission to GRANT or REVOKE or DENY new permissions !

thanks in advance.
Posted

SQL
REVOKE privilege_name
ON object_name
FROM {user_name |PUBLIC |role_name}
 
Share this answer
 
thanks. solved:

use myDB revoke grant option for select from user2
 
Share this answer
 
Hi

SQL
GRANT <permission> [ ,...n ] ON 
    [ OBJECT :: ][ schema_name ]. object_name [ ( column [ ,...n ] ) ]
    TO <database_principal> [ ,...n ] 
    [ WITH GRANT OPTION ]
    [ AS <database_principal> ]

<permission> ::=
    ALL [ PRIVILEGES ] | permission [ ( column [ ,...n ] ) ]

<database_principal> ::= 
        Database_user 
    | Database_role 
    | Application_role 
    | Database_user_mapped_to_Windows_User 
    | Database_user_mapped_to_Windows_Group 
    | Database_user_mapped_to_certificate 
    | Database_user_mapped_to_asymmetric_key 
    | Database_user_with_no_login


Don't Give [WITH GRANT OPTION] then user 2 can't Give rights to user1.

Check the following link


SQL GRANT Command
[^]
Giving and removing permissions in SQL Server[^]


Regards,
GVPrabu
 
Share this answer
 
v2
Comments
Mohamad77 2-Mar-13 0:15am    
thanks, but the grant permission is previously granted to user2 ! NOW how can I revoke this permission which is previously granted !?
gvprabu 2-Mar-13 0:19am    
yes , then u will REVOKE the permission then again give the permission to user 2
Mohamad77 2-Mar-13 0:44am    
oh, YES, you're right ;) thanks alot
gvprabu 2-Mar-13 0:45am    
:-) :-) :-) welcome...

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900