Expand All
Collapse the table of content
Expand the table of content
Expand Minimize
The document is archived and information here might be outdated

sp_addgroup (Transact-SQL)

Creates a group in the current database.

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 icon Transact-SQL Syntax Conventions

sp_addgroup [ @grpname = ] 'group'

[ @grpname = ] 'group'

Is the name of the group to add. group is sysname, with no default.

0 (success) or 1 (failure)

To add the new group, sp_addgroup calls sp_addrole.

Requires CREATE ROLE permission on the database.

The following example creates the group accounting.

EXEC sp_addgroup 'accounting' ;
© 2016 Microsoft