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
Solved

create script to add user with roles

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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Introduction: When running hybrid database environments, you often need to query some data from a remote db of any type, while being connected to your MS SQL Server database. Problems start when you try to combine that with some "user input" pass…
In this article we will get to know that how can we recover deleted data if it happens accidently. We really can recover deleted rows if we know the time when data is deleted by using the transaction log.
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

856 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