sp_changegroup

Description

Changes a user’s group.

Syntax

sp_changegroup grpname, username

Parameters

grpname

is the name of the group. The group must already exist in the current database. If you use “public” as the grpname, enclose it in quotes, because it is a keyword.

username

is the name of the user to be added to the group. The user must already exist in the current database.

Examples

Example 1

The user “albert” is now a member of the “fort_mudge” group. It doesn’t matter what group “albert” belonged to before:

sp_changegroup fort_mudge, albert

Example 2

Removes “albert” from the group he belonged to without making him a member of a new group (all users are always members of “public”):

sp_changegroup "public", albert

Usage

Permissions

Only the Database Owner, a System Administrator, or a System Security Officer can execute sp_changegroup.

See also

Commands grant, revoke

System procedures sp_addgroup, sp_adduser, sp_dropgroup, sp_helpgroup