Changing database ownership

A System Administrator might want to create the user databases and give ownership of them to another user after completing some of the initial work. sp_changedbowner changes the ownership of a database. The procedure must be executed by the System Administrator in the database where the ownership will be changed. The syntax is:

sp_changedbowner loginame [, true ] 

The following example makes the user “albert” the owner of the current database and drops the aliases of users who could act as the former “dbo.”

sp_changedbowner albert 

The new owner must already have a login name in Adaptive Server, but he or she cannot be a user of the database or have an alias in the database. You may have to use sp_dropuser or sp_dropalias before you can change a database’s ownership. See the Chapter 9, “Security Administration,” for more information about changing ownership.

To transfer aliases and their permissions to the new Database Owner, add the second parameter, true.

NoteYou cannot change ownership of the master database. It is always owned by the “sa” login.