Solved

create script to add user with roles

Posted on 2007-03-27
1
317 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
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

Optimizing Cloud Backup for Low Bandwidth

With cloud storage prices going down a growing number of SMBs start to use it for backup storage. Unfortunately, business data volume rarely fits the average Internet speed. This article provides an overview of main Internet speed challenges and reveals backup best practices.

Question has a verified solution.

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

Suggested Solutions

by Mark Wills Attending one of Rob Farley's seminars the other day, I heard the phrase "The Accidental DBA" and fell in love with it. It got me thinking about the plight of the newcomer to SQL Server...  So if you are the accidental DBA, or, simp…
When writing XML code a very difficult part is when we like to remove all the elements or attributes from the XML that have no data. I would like to share a set of recursive MSSQL stored procedures that I have made to remove those elements from …
Along with being a a promotional video for my three-day Annielytics Dashboard Seminor, this Micro Tutorial is an intro to Google Analytics API data.
Both in life and business – not all partnerships are created equal. As the demand for cloud services increases, so do the number of self-proclaimed cloud partners. Asking the right questions up front in the partnership, will enable both parties …

912 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

22 Experts available now in Live!

Get 1:1 Help Now