Share via


sp_addgroup (Transact-SQL)

Creates a group in the current database.

Important

sp_addgroup provides compatibility with earlier versions of SQL Server. This feature will be removed in the next version of Microsoft SQL Server. Avoid using this feature in new development work, and plan to modify applications that currently use this feature. Use roles instead. For more information, see CREATE ROLE (Transact-SQL).

Topic link iconTransact-SQL Syntax Conventions

Syntax

sp_addgroup [ @grpname = ] 'group'

Arguments

  • [ @grpname = ] 'group'
    Is the name of the group to add. group is sysname, with no default.

Return Code Values

0 (success) or 1 (failure)

Remarks

To add the new group, sp_addgroup calls sp_addrole.

Permissions

Requires CREATE ROLE permission on the database.

Examples

The following example creates the group accounting.

EXEC sp_addgroup 'accounting' ;

See Also

Reference

Security Stored Procedures (Transact-SQL)
CREATE ROLE (Transact-SQL)
sp_changegroup (Transact-SQL)
sp_dropgroup (Transact-SQL)
sp_helpgroup (Transact-SQL)
sp_helprole (Transact-SQL)
System Stored Procedures (Transact-SQL)

Help and Information

Getting SQL Server 2005 Assistance