Every day in our datawarehouse (that wil be dynamicly) the tables are dropped and rebuild. Also is it possible that some developer in our organisation wil create more tables in that database. Because of that i can not give permissions to one database that are persistent.
Question: I want to make some kind of a job that runs every day, that lists all de table names (that are existing at that time) in a database like 'Select * form sys.tables' Then i want the tables names as an input value to a script that runs trough all table names and places them in a scentense like
GRANT SELECT TO [Tablename1] TO [ROLE_READALLTABLES Except 1 table],
GRANT SELECT TO [Tablenaam2] TO [ROLE_READALLTABLES Except 1 table]
en so go on in a loop until all existing tables are read So all tables (except 1 table )in the entire database should get de GRANT SELECT permission.
I have looked beween all the answers, but i can not seems to get a good idea how to get this to work. I hope someone can help me with this.
UPDATE I use MS SQL Server 2014, i work with SQL management studio 2014
Aucun commentaire:
Enregistrer un commentaire