sp_changedbowner

Description

Changes the owner of a user database.

Syntax

sp_changedbowner loginame[, true]

Parameters

loginame

is the login name of the new owner of the current database.

true

transfers aliases and their permissions to the new database owner. Values are “true” and “TRUE”.

Examples

Example 1

Makes the user “albert” the owner of the current database:

sp_changedbowner albert

Usage

Permissions

A user with sa_role or sso_role privileges can execute sp_changedbowner.

sp_changedbowner is used to change the owner of a database. You can execute it with either sa_role or sso_role privileges.

Auditing

Values in event and extrainfo columns from the sysaudits table are:

Event

Audit option

Command or access audited

Information in extrainfo

38

exec_procedure

Execution of a procedure

  • Roles – Current active roles

  • Keywords or options – NULL

  • Previous value – NULL

  • Current value – NULL

  • Other information – All input parameters

  • Proxy information – Original login name, if set proxy in effect

See also

Commands create database

System procedures sp_addlogin, sp_dropalias, sp_dropuser, sp_helpdb