Solved

DB ACCESS Stored Procedure

Posted on 2004-10-13
3
352 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:basile
  • 2
3 Comments
 
LVL 34

Accepted Solution

by:
arbert earned 500 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:basile
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

Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
convert in derived column 7 27
Slow Connectivity over ODBC 8 32
string fuctions 4 25
SQL Improvement  ( Speed) 14 26
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…
I have a large data set and a SSIS package. How can I load this file in multi threading?
Using examples as well as descriptions, and references to Books Online, show the different Recovery Models available in SQL Server and explain, as well as show how full, differential and transaction log backups are performed
Via a live example, show how to backup a database, simulate a failure backup the tail of the database transaction log and perform the restore.

815 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