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
 General SQL Server Forums
 New to SQL Server Administration
 Change User and Default Schema for a Login

Author  Topic 

planetoneautomation
Posting Yak Master

105 Posts

Posted - 2010-10-01 : 12:53:09
I'm trying to change the User and Default Schema for a Login (User Mappings) for a database.

I get an error that I can't alter the user 'dbo' ... I'm not trying to alter the user 'dbo' ... just change the User and Default Schema for a Login. I don't understand the error.

Ideas?

robvolk
Most Valuable Yak

15732 Posts

Posted - 2010-10-01 : 13:14:54
Logins are server-level objects. Users and schemas are database-level. A database is owned by a login, which is mapped as the dbo user in that database. You will probably have to change the database owner in order to map that user to a new default schema.
Go to Top of Page

planetoneautomation
Posting Yak Master

105 Posts

Posted - 2010-10-01 : 13:38:51
I thought about that but another database is setup like I want this one and its owner is 'sa' just like the one I'm having a problem with. Just to see, I changed the database owner from 'sa' to 'td' ('td' being the user and default schema I want to set the mappings to) ... after changing owner to 'td' I tried to change the user and default schema to 'td' and it still says I can't alter the user 'dbo'.

So I'm still stuck - any other ideas/suggestions?

Thanks for your help
Go to Top of Page

robvolk
Most Valuable Yak

15732 Posts

Posted - 2010-10-01 : 13:47:26
See if the user is a member of the db_owner role and remove them if they are.
Go to Top of Page

planetoneautomation
Posting Yak Master

105 Posts

Posted - 2010-10-01 : 14:16:28
RESOLVED: What I had to do was remove the db from the user mappings and rename the database user 'td'. Then I was able to re-add the user mapping for the database and specify 'td'. Apparently the 'td' user is created when the mapping is done.
Go to Top of Page
   

- Advertisement -