sp_dropgroup System Stored Procedure

Removes a group from a database.

Syntax

sp_dropgroup grpname

where

grpname
Specifies which group to drop from the current database.

Remarks

Executing sp_dropgroup drops a group name from a database's sysusers table.

You cannot drop a group that has members. Before you can drop the group, you must execute sp_changegroup for each member.

Example

In this example, the purchasing group has merged with the accounting group. Members of the purchasing group, Martha (username Martha) and George (username George), are moved. Martha is moved to the accounting group, George is moved to the public group. Then the purchasing group is dropped. The group name public is enclosed in single quotation marks because public is a reserved word.

sp_changegroup accounting, Martha
EXEC sp_changegroup 'public', George
EXEC sp_dropgroup purchasing

Permission

Only the database owner can use this procedure.

Tables Used

sysobjects, sysprotects, sysusers

See Also

GRANT sp_changegroup
REVOKE sp_dropuser
sp_addgroup sp_helpgroup
sp_adduser USE