User Login for new databases

  • Hello

    My use case is this:

    I have a developer that runs a script that reads information from our application databases on a server.

    Our support department adds new application databases as we get new customers.

    I need a login to which I can assign a security context that will give read only access as the new databases are added by the support department without having to explicitly grant access to the new databases each time one is created.

    I know how to create a login that is readonly for databases that currently reside on the server, but is there any way to create a login that allow read only access to new databases as they are created?

    Steve

  • You can set up the user in the model database with db_datareader, then when a new database is created that user will become a member of db_datareader in the new database.

    Facts are stubborn things, but statistics are more pliable - Mark Twain
    Carolyn
    SQLServerSpecialists[/url]

  • New databases when created are based on the Model database. Create the login that you want in all new databases in the Model

    From BOL

    When a CREATE DATABASE statement is issued, the first part of the database is created by copying in the contents of the model database. The rest of the new database is then filled with empty pages.

    If you modify the model database, all databases created afterward will inherit those changes. For example, you could set permissions or database options, or add objects such as tables, functions, or stored procedures

    If everything seems to be going well, you have obviously overlooked something.

    Ron

    Please help us, help you -before posting a question please read[/url]
    Before posting a performance problem please read[/url]

  • That's what I was looking for, a simple but effective solution.

    Thanks,

    Steve

Viewing 4 posts - 1 through 3 (of 3 total)

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