Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2008 Forums
 SQL Server Administration (2008)
 User Rights for Particular Databases

Author  Topic 

Kalaiselvan
Posting Yak Master

112 Posts

Posted - 2012-12-03 : 12:43:27
Hi,
we are using SQL server 2008 as our DB server. And Admin User is used for all Transactions and Applications.
Now a New Database is created for Payroll purpose. DB Name: PAYROLL. Need to give User Rights for this particular DB for single User and not even for Admin user.

New User: PayrollUser = Can access this Database.
Admin User: Can access all Database other than PAYROLL DB.

Please help me how to provide the Rights for New User and Deny the Rights for Admin User.


Regards,
Kalaiselvan R
Love Yourself First

Regards,
Kalai

sunitabeck
Master Smack Fu Yak Hacker

5155 Posts

Posted - 2012-12-03 : 14:17:39
If you mean by "admin user", you mean a login who is a member of the sysadmin role on the server, then you cannot prevent that user from accessing any database they choose to, on that server.
Go to Top of Page

Kalaiselvan
Posting Yak Master

112 Posts

Posted - 2012-12-04 : 00:46:05
K. Then can we create a User who can access All DB except PAYROLL DB. And another User to access only PAYROLL DB.


Regards,
Kalai
Go to Top of Page

sodeep
Master Smack Fu Yak Hacker

7174 Posts

Posted - 2012-12-05 : 16:00:12
Yes unless they are member of sysadmin
Go to Top of Page

Kalaiselvan
Posting Yak Master

112 Posts

Posted - 2012-12-10 : 12:26:57
Guide me to create a User to access only the PAYROLL DB and not other DB's.

Regards,
Kalai
Go to Top of Page

sunitabeck
Master Smack Fu Yak Hacker

5155 Posts

Posted - 2012-12-10 : 12:54:01
In SSMS object explorer, at the server level, right click on Security -> Logins and select New Login. Select/specify the appropriate fields. To grant access to the specific database, under the User Mapping tab, click on the database name and grant appropriate permissions.

For end users, I usually grant only public role and then grant permissions on specific stored procedures as required.
Go to Top of Page
   

- Advertisement -