Friday, November 19, 2010

How to add users to security to SQL table?

How do I add a user at the table level rather than the database level?



I have a large database that management wants me to add another department as a user for several tables but not the entire database. I am unable to find how to add users for specific tables and keep them out of others in the database.



Is this possible in SQLServer?How to add users to security to SQL table?
It's an interesting question and not something I've done myself before.



I was thinking that the only way to do this may be to create the tables in a different schema in order to assign your users access to this schema only but changing the schema might have a further impact, particularly if there are stored procedures referencing the tables under the dbo schema.



A good compromise to this might be to create a view for each table but assign the views to the new schema that only your list of people will have access to.



Hope this helps.How to add users to security to SQL table?
Use GRANT and REVOKE statements for permissions of your users on the specific database objects.

No comments:

Post a Comment