Solved

DB ACCESS Stored Procedure

Posted on 2004-10-13
3
353 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

Back Up Your Microsoft Windows Server®

Back up all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
T-SQL 10 32
SQL Stored Proc - Performance Enhancement 15 52
sql 2016 Integration Service connecting to 2012 3 29
Add a step to a system backup job 6 15
Let's review the features of new SQL Server 2012 (Denali CTP3). It listed as below: PERCENT_RANK(): PERCENT_RANK() function will returns the percentage value of rank of the values among its group. PERCENT_RANK() function value always in be…
This article shows gives you an overview on SQL Server 2016 row level security. You will also get to know the usages of row-level-security and how it works
This videos aims to give the viewer a basic demonstration of how a user can query current session information by using the SYS_CONTEXT function
Via a live example, show how to setup several different housekeeping processes for a SQL Server.

789 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