?
Solved

DB ACCESS Stored Procedure

Posted on 2004-10-13
3
Medium Priority
?
356 Views
Last Modified: 2012-08-13
Is there a stored procedure for adding db access such as db_datareader, db_datawriter that can be scripted ? i have tried sp_addrole, sp_grantdbaccess but these don't address the specific database acesss.
0
Comment
Question by:Auerelio Vasquez
[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
  • 2
3 Comments
 
LVL 34

Accepted Solution

by:
arbert earned 2000 total points
ID: 12303647
Not totally what you want, but this will add a user to the db_datareader:

EXEC sp_addrolemember 'db_datareader', 'youruserhere'
0
 
LVL 1

Author Comment

by:Auerelio Vasquez
ID: 12304656
Will this work with a current user ? and can i add multi attributes, like db_datareader and db_datawriter ?

0
 
LVL 34

Expert Comment

by:arbert
ID: 12305019
Ya, the above works only for a current user.  To add multiple roles, you would have to execute it multiple times with the different role...

Brett
0

Featured Post

Three Reasons Why Backup is Strategic

Backup is strategic to your business because your data is strategic to your business. Without backup, your business will fail. This white paper explains why it is vital for you to design and immediately execute a backup strategy to protect 100 percent of your data.

Question has a verified solution.

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

Ever needed a SQL 2008 Database replicated/mirrored/log shipped on another server but you can't take the downtime inflicted by initial snapshot or disconnect while T-logs are restored or mirror applied? You can use SQL Server Initialize from Backup…
A Stored Procedure in Microsoft SQL Server is a powerful feature that it can be used to execute the Data Manipulation Language (DML) or Data Definition Language (DDL). Depending on business requirements, a single Stored Procedure can return differe…
Via a live example, show how to extract information from SQL Server on Database, Connection and Server properties
Via a live example, show how to extract insert data into a SQL Server database table using the Import/Export option and Bulk Insert.
Suggested Courses

752 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