Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Sql Server 2005 how to change dbo login name

I have a database with user 'dbo' that has a login name "domain\xzy". How do I change it from "domain\xzy" to "domain\abc".

like image 253
410 Avatar asked Oct 02 '08 14:10

410


People also ask

How do I rename a user in SQL Server?

To change the name of a user requires the ALTER ANY USER permission. To change the target login of a user requires the CONTROL permission on the database. To change the user name of a user having CONTROL permission on the database requires the CONTROL permission on the database.

Is DBO a user in SQL Server?

The dbo user is a special user principal in each database. All SQL Server administrators, members of the sysadmin fixed server role, sa login, and owners of the database, enter databases as the dbo user. The dbo user has all permissions in the database and cannot be limited or dropped.


2 Answers

I figured it out. Within SQL Management Studio you have to right-click on the database -> Properties -> Files -> Owner field. Change this field to the login name/account that you want associated with the "dbo" username for that database. Please keep in mind that the login name/account you choose must already be setup in the sql server under Security -> Logins

like image 120
410 Avatar answered Oct 03 '22 00:10

410


If you are trying to remap a login to a db user you can use sp_change_user_login

exec sp_change_user_login 'Update_One', 'user', 'login'

like image 21
Thad Avatar answered Oct 02 '22 22:10

Thad