SCRIPTS FOR LOGIN CREATION AND USER MAPPING TO DATABASE

  • The Gurus,

    I need help with a script that could pick a username and create a login for it in SQL Server. I have about 300 usernames to create logins for and I think it will be tedious doing them one after the other. Also, I want the same script or another to be able to map a username with a specific database.

    The whole scenario is like this. I have an application (with SQL Server back end) that creates a storage area (database) in SQL Server. I now need a script that will be able to take a username from the active directory and create a SQL Server login for that username as well as mapping that username with a specific database. I want each user to have access to a database each.

    I will so much appreciate it if someone could give me a script that could do this.

    Many thanks.

    Sahoong.

  • Hi

    Before answering your post could you please giver reply to these

    How can u taking username from active dir?

    How to find the all the username from sql server?

    How to grant more than one permission more than one user?

  • If all 300 of those logins are AD, then why do you want 300 matching SQL logins?

    Add those logins to a domain group, grant the domain group login rights on SQL and map that group to the DB. Single login, minimal admin work.

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass

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

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