SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 SQL Server 2008 Forums
 SQL Server Administration (2008)
 Disabled user
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

Peter99
Constraint Violating Yak Guru

494 Posts

Posted - 07/05/2012 :  18:51:24  Show Profile  Reply with Quote
Hi,

Under users tab, one user shows disabled (red down arrow). This user has login on server level which is enabled. I want to enable this user on db level but cannot. I right clicked on it but there is no option to disable it. I searched net but did not find any option to enable db user. There are some command to enable login but not users. Any help will be appreciated.

Thanks

sunitabeck
Flowing Fount of Yak Knowledge

5155 Posts

Posted - 07/06/2012 :  10:15:44  Show Profile  Reply with Quote
Is there perhaps a SID mismatch between the user and the login? You can look up the SIDs like shown below, and they should match:
USE MyDB
GO
SELECT SID FROM sys.syslogins WHERE NAME = 'testsql';
SELECT SID FROM sys.sysusers WHERE NAME = 'testsql';
If there is a mismatch, use sp_change_users_login to fix it. http://msdn.microsoft.com/en-us/library/ms174378.aspx
Go to Top of Page

Peter99
Constraint Violating Yak Guru

494 Posts

Posted - 07/06/2012 :  10:34:39  Show Profile  Reply with Quote
Thanks for reply.
Go to Top of Page

Peter99
Constraint Violating Yak Guru

494 Posts

Posted - 07/06/2012 :  10:40:47  Show Profile  Reply with Quote

I just created another user with same name. Granted it permissions. Now it is working.

My question is:

How to enable a user which is in disable state. I am asking about user not login.

Is there any command?

For login we can use alter login <login name> enable/disable

How to do the same thing with user? Suppose I don't want to delete user but I just want to disable it?

Thanks

Go to Top of Page

Krishna_DBA
Starting Member

4 Posts

Posted - 07/09/2012 :  15:00:05  Show Profile  Reply with Quote
run the below command to enable the user on that database

sp_grantdbaccess <username>
Go to Top of Page

Peter99
Constraint Violating Yak Guru

494 Posts

Posted - 07/14/2012 :  19:35:27  Show Profile  Reply with Quote
another option is grant user connect privileges. Right click on user, go to properties, click permission and click connect.
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.08 seconds. Powered By: Snitz Forums 2000