Solved

create script to add user with roles

Posted on 2007-03-27
1
340 Views
Last Modified: 2008-02-01
how can i create a script instead of doing this manually.  also where do u run script in sqlserver 2005?
somehow the user needs to be ilike below
MSProjectServerUser - Type a password you will remember; Set the default database to “ProjectServer“; User Mapping = ProjectServer, MSProjectServerRole.
MSProjectUser - Type a password you will remember; Set the default database to “ProjectServer“; User Mapping = ProjectServer, MSProjectRole.
0
Comment
Question by:gianitoo
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 16

Accepted Solution

by:
rboyd56 earned 500 total points
ID: 18805146
I'm not sure this is what you need but here goes:

From the master database:

CREATE LOGIN MSProjectServerUser
WITH
    PASSWORD = 'password',    
    DEFAULT_DATABASE = Projectserver

sp_addsrvrolemember 'MSProjectServerRole', 'MSProjectServerUser'

In the ProjectServer database:

CREATE USER MSProjectServer for Login MSProjectServerUser

sp_addrolemember 'MSProjectRole', 'MSProjectServer'

This may not be exactly what you are looking for but you can look at Books on Line for the following commands to get the exact syntax:

CREATE LOGIN
CREATE USER
sp_addsrvrolemember
sp_addrolemember

You run these commands in Management Studio in a Query window.

0

Featured Post

NEW Veeam Agent for Microsoft Windows

Backup and recover physical and cloud-based servers and workstations, as well as endpoint devices that belong to remote users. Avoid downtime and data loss quickly and easily for Windows-based physical or public cloud-based workloads!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

In this article I will describe the Copy Database Wizard method as one possible migration process and I will add the extra tasks needed for an upgrade when and where is applied so it will cover all.
Use this article to create a batch file to backup a Microsoft SQL Server database to a Windows folder.  The folder can be on the local hard drive or on a network share.  This batch file will query the SQL server to get the current date & time and wi…
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial

726 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question