0

I'm working on a project that requires a database user to have only SELECT and INSERT permissions for all tables in a database.

The following question provides a solution but I'd have to run the script every time I add a new table. Seems like it's specific to SQL Server 2000.

There must be an easier way?

1

In my case, I have only a single schema dbo. So, instead of adding permissions to each table, it's easier to add it to the schema.

GRANT SELECT, INSERT ON SCHEMA::dbo to [my_user]

This way, each time a table is added to that schema the permissions will be applied automatically. For all my projects the schema rarely change (compared to the number of times a new table is added) so it's acceptable to run this one if a new schema is added.

Maybe other answers would provide a solution where the permissions can be applied at the database level?

  • 1
    To grant for the whole database just use GRANT SELECT, INSERT to [my_user] – David Browne - Microsoft Aug 31 '17 at 19:01
  • @DavidBrowne-Microsoft really? urgh, "couldnt see the forest for the trees" or something! – Kevin Brydon Aug 31 '17 at 19:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.