change dbo user to windows login name

I am trying to add a windows user to a database in Security of that database but I am getting the error " The login already has an account under a different user name so when I  check this windows user,this windows login name exist as dbo user name like attached file so how do we change this dbo user to windows login name?
dbo.jpg
Teoman SahinAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Anoo S PillaiCommented:
The mentioned windows login is already mapped as dbo ( database owner ) .  If you want to map the windows login as a separate user in the mentioned database, first you should map another login as dbo ( database owner). To do this from script, the procedure sp_changedbowner can be used.

Use   <<YourDBName>>
Go
sp_changedbowner '<<SomeotherLoginName>>'

( If you want to do from SSMS interface, then Right Click on database ->> Properties ->> Select Files Page ->> Change the owner by clicking on the button adjacent to Owner text box ) .

Then you would be able to map windows login.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Teoman SahinAuthor Commented:
I have already changed the owner to domain\xyz user from Properties ->> Select Files Page ->> Change the owner by clicking on the button adjacent to Owner text box but when I check the Security of that database, I am still seeing the dbo user and in properties of dbo

Username=dbo
login name= domain\xyz

so we have to change username=dbo to domain\xyz
how to map it?
0
Anoo S PillaiCommented:
1) If you are using mixed authentication, can you try sp_changedbowner from SSMS Query windows and post the response from SQL server- , as well the

Use   <<YourDBName>>
Go
sp_changedbowner 'sa'   -- or any other SQL login

2) BTW, what you are trying to achieve by this ?
0
Anoo S PillaiCommented:
Hi,

I think that you did a good amount of extra work to resolve the problem from the grading provided. Could you please post a short note on the actions that you have taken to resolve the issue..

That would be a reference for future.

Thanks in advance,
Anoo
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft SQL Server 2008

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.