Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Administration (2000)
 Grants/Permissions - access to one table only

Author  Topic 

shaneschmidt
Starting Member

17 Posts

Posted - 2004-05-09 : 20:33:48
I have a user that belongs to a particular group. We want to give him
read only access to only one table in this database at this time.
Is there an easy way or script to do this without going through the GUI and ticking/denying him all.

SQLServerDBA_Dan
Aged Yak Warrior

752 Posts

Posted - 2004-05-09 : 21:04:59
You should think about adding a role and applying the DENY's to it. Then you can add as many users as you wish to the role and you wouldn't need to do this again.

Try this:

Select 'DENY SELECT ON ' + name + ' TO rl_DenyObjects' from sysobjects where type = 'U' and name not like 'dt%'

Copy and paste the results to the query window and run them. This will deny all tables on a role name "rl_DenyObjects". You will need to create the role.

Daniel
SQL Server DBA
Go to Top of Page
   

- Advertisement -