?
Solved

create script to add user with roles

Posted on 2007-03-27
1
Medium Priority
?
350 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 2000 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

Does Your Cloud Backup Use Blockchain Technology?

Blockchain technology has already revolutionized finance thanks to Bitcoin. Now it's disrupting other areas, including the realm of data protection. Learn how blockchain is now being used to authenticate backup files and keep them safe from hackers.

Question has a verified solution.

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

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…
I am showing a way to read/import the excel data in table using SQL server 2005... Suppose there is an Excel file "Book1" at location "C:\temp" with column "First Name" and "Last Name". Now to import this Excel data into the table, we will use…
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…

764 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