Adds a group to a database. Groups are used as collective names in granting and revoking privileges.
sp_addgroup grpname
sp_addgroup accounting
sp_addgroup adds the new group to a database’s sysusers table. Each group’s user ID (uid) is 16384 or larger (except “public,” which is always 0).
A group and a user cannot have the same name.
Once a group has been created, add new users with sp_adduser. To add an existing user to a group, use sp_changegroup.
Every database is created with a group named “public”. Every user is automatically a member of “public”. Each user can be a member of one additional group.
See also grant, revoke in Reference Manual: Commands.
The permission checks for sp_addgroup differ based on your granular permissions settings.
Setting | Description |
---|---|
Enabled | With granular permissions enabled, you must be a user with manage any user privilege. |
Disabled | With granular permissions disabled, you must be the database owner, a user with sso_role, or a user with sa_role. |
Values in event and extrainfo columns from the sysaudits table are:
Information | Values |
---|---|
Event | 38 |
Audit option | exec_procedure |
Command or access audited | Execution of a procedure |
Information in extrainfo |
|