We help IT Professionals succeed at work.

We've partnered with Certified Experts, Carl Webster and Richard Faulkner, to bring you two Citrix podcasts. Learn about 2020 trends and get answers to your biggest Citrix questions!Listen Now

x

User has lost Login Name

JordanKingsley
on
Medium Priority
1,133 Views
Last Modified: 2008-01-09
Hello all. We have a Citrix database with a server login called Citrix_User, and User in that database with the same name. I had to restart the server yesterday to swap some drives. Today when I go to the properties of Citrix_User in the database the login shows <none>. When I try and delete that user it says "The selected user cannot be dropped because the user owns objects". Can you guys tell me how to both get that login back and how to delete the user account (I've created another one that Citrix is now using, but need to know in case that happens again).  Thanks, Jordan
Comment
Watch Question

Database Consultant
CERTIFIED EXPERT
Top Expert 2009
Commented:
Hi JordanKingsley,
in order to change the ownership of the objects you can use the following

DECLARE @old sysname, @new sysname, @sql varchar(1000)
SELECT @old = 'Citrix_User' ,
@new = 'dbo' ,
@sql = ' IF EXISTS (SELECT NULL FROM INFORMATION_SCHEMA.TABLES WHERE QUOTENAME(TABLE_SCHEMA)+''.''+QUOTENAME(TABLE_NAME) = ''?'' AND TABLE_SCHEMA = ''' + @old + ''' )

EXECUTE sp_changeobjectowner ''?'', ''' + @new + ''''EXECUTE sp_MSforeachtable @sql


then try to recreate the login

Not the solution you were looking for? Getting a personalized solution is easy.

Ask the Experts

Author

Commented:
I'm sure I understand what that did. How do I delete that user?

Commented:
In order to be able to log in with the user you should just need to set the (default) database to a valid database. This normally gets set to none if the database that was originally the user's default database has been dropped. This includes if the database was dropped and re-created.

Author

Commented:
I see, but how to I delete a user that I don't need anymore and I still get the message:

"The selected user cannot be dropped because the user owns objects"
Access more of Experts Exchange with a free account
Thanks for using Experts Exchange.

Create a free account to continue.

Limited access with a free account allows you to:

  • View three pieces of content (articles, solutions, posts, and videos)
  • Ask the experts questions (counted toward content limit)
  • Customize your dashboard and profile

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.