Monday, March 26, 2012

Read Only Table in SQL Server?

Is it possible to make a table (or set of tables) within a SQL Server database read only (still granting the db_datawriter fixed database role to database users) without dropping and recreating the db_datawriter database role?I don't think that you can set a table read-only if the users are member of the db_datawriter role.

But you can created a new role in which you will give the SELECT right on every table and the INSERT and UPDATE on some table.

The other possibility is to DENY tthe INSERT and UPDATE rights on the table that you want to set Read-Only. The Deny always override the Allow right. This way, your user will be part of the db_datawriter and you will explicitly override (and deny) the insert and update rights on some table.

Cya

No comments:

Post a Comment