Ask Learn
Preview
Please sign in to use this experience.
Sign inThis browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
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).
Transact-SQL Syntax Conventions
sp_addgroup [ @grpname = ] 'group'
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' ;
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)
Please sign in to use this experience.
Sign in