How can I make a SQL Server database inherit users and role memberships when they are attached?

StackOverflow https://stackoverflow.com/questions/14739131

Frage

When I attach a database I would like for several users to be created on it and for them to be assigned to certain fixed database roles. Any way to ensure that this happens automatically (potentially for hundreds of databases being attached at one time) or are there any tools / utilities out there for this sort of thing?

If there's no way to do this for attaching databases, is there a way to do it for newly created databases? For example, if I add the users and the roles to the model database, will those objects and membership be inherited by newly created databases? It doesn't seem to work so far.

Keine korrekte Lösung

Andere Tipps

A way to handle this by an activation initiated via the SQL Server Service Broker Event:

Implementing Internal Activation

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top