how to give permissions for more than one person at a time

  • hi,

    i have just started my job as a junior SQLDBA.

    i had a doubt regarding security. in sql server2000, by using Enterprise manager we can create only one user/login at a time.

    Is there any other way to create more logins with different permissions at a time.

    for example: how create 20 user/logins at a time with different permissions.

    can any body help me with an example.

  • You can create a script that contains a series of sp_add_login (or sp_grantlogin if adding Windows logins), sp_add_user, and grant statements.

    Example:

    EXEC master..sp_addlogin 'App_Login1' ,'passwd', 'TempDB'

    use yourdb

    EXEC master..sp_adduser 'App_Login1','App_User1'

    Grant SELECT on table1 to App_User1

    --------

    EXEC master..sp_addlogin 'App_Login2' ,'passwd', 'TempDB'

    use yourotherdb

    EXEC master..sp_adduser 'App_Login2','App_User2'

    Grant SELECT on table1 to App_User2

    See BooksOnLine for more examples.

    Greg

  • Also you shouldn't grant permissions to users. You should make roles, even if it's 20 roles, and add the users to the role. Then grant permissions to the roles.

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

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