4

Is it different from the dbcreator permission?

Can anybody explain the process?

1
  • How is this off-topic? I could understand “closed because could be answered with minimable research” but since this page is now Google's top hit for “sql server grant create database to user” that would now seem unreasonable. May 11, 2021 at 12:19

1 Answer 1

9

The Server-Level Roles documentation says:

Members of the dbcreator fixed server role can create, alter, drop, and restore any database.

This obviously exceeds the ability to just "create any database" mentioned in the title of your question.

To add a login to the dbcreator role:

EXECUTE sys.sp_addsrvrolemember
    @loginame = N'LoginName',
    @rolename = N'dbcreator';

The process to grant only the permission CREATE ANY DATABASE is as simple as:

-- Must be in master to grant server-scoped permissions
USE master;
GRANT CREATE ANY DATABASE TO LoginName;

It is generally seen as best practice to grant only the minimum permissions required.

Not the answer you're looking for? Browse other questions tagged or ask your own question.