Solved

create script to add user with roles

Posted on 2007-03-27
1
301 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
1 Comment
 
LVL 16

Accepted Solution

by:
rboyd56 earned 500 total points
Comment Utility
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

Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

Join & Write a Comment

Recently, when I was asked to create a new SQL 2005 cluster, Microsoft released a new service pack for MS SQL 2005 what is Service Pack 3. When I finished the installation of MS SQL 2005 I found myself troubled why the installation of SP3 failed …
by Mark Wills PIVOT is a great facility and solves many an EAV (Entity - Attribute - Value) type transformation where we need the information held as data within a column to become columns in their own right. Now, in some cases that is relatively…
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

772 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now