AUTHORIZATION

AUTHORIZATION is an SQL clause that can be used to specify the owner of an object at the time of that object's creation. It's typically used in Data Definition Language (DDL) statements.

Example

CREATE DATABASE TestDB
GO
ALTER AUTHORIZATION ON DATABASE::TestDB TO User1
GO

Output

Command(s) completed successfully.

Explanation

The above SQL code block creates a new database named TestDB in SQL Server. Once the database is successfully created, the second statement changes the authorization of the TestDB database to User1. This means User1 now owns the TestDB database. The output shows that the command execution was successful.

For in-depth explanations and examples SQL keywords where you write your SQL, install our extension.