model database

  • Every time i create a database on the server there would be 3 tables created which would be standard across the server,once these tables are created i revoke alter permissions on these table for some users. how would i automate this ?

    can i do somethign in the model database where that would apply across all the databases when created?

  • Hi Tara,

    Just do that in Model DB and those changes get reflected in al the new dbs created inclusing those permissions.

    Thank You,

    Best Regards,

    SQLBuddy.

  • I have a stored proc to do that but how does it get executed as and when there is a new database?

  • Stored procedure to do what ..

    Thank You,

    Best Regards,

    SQLBuddy

  • The SP i created will deny permission for some users on few tables to drop or update them. I would like this to be executed as and when new database is created. The new database will have these tables by default when created.

  • you need to create trigger for this event and place the trigger in master. It will keep track of any new databases addedd and will execute accordingly.

    ----------
    Ashish

  • how does the trigger keep track of any new database?

  • it will fired whenever there is any syntax like create database either by query analyzer or EM

    ----------
    Ashish

  • If those tables are fixed and if those users are fixed with their permissions do that table creation and assign those required permisiions to those users in the Model DB and that should be replicated for evry new db that will be created.

    Thank You,

    Best Regards,

    SQLBuddy

  • tables are fixed but will be created after the database is created.

    If i have to execute this through a trigger how do i fire it across all databases when these tables are created.

  • if your tables are fixed then just add those tables in model. And everytime you create new database, these tables will be there. As well you can configure the users permission those table which will also replicated similarly.

    ----------
    Ashish

Viewing 11 posts - 1 through 11 (of 11 total)

You must be logged in to reply to this topic. Login to reply