Jeff Puckett
Jeff Puckett

Reputation: 40971

How to add a SQL Server role as a member of another role?

I would like to roll-up permissions. Is it possible to add a role as a member of another role in a Microsoft SQL Server 2016 database? If so, then how?

Upvotes: 6

Views: 6254

Answers (1)

Jeffrey Van Laethem
Jeffrey Van Laethem

Reputation: 2651

Yes, it is possible. simply by using sp_addrolemember, or the GUI as you'd normally add a user to a role:

ALTER ROLE 'BigRole' ADD MEMBER 'LittleRole'

Note that SQL Server will prevent you from making a role a member of itself, so if "BigRole" is already a member of "LittleRole", the above will fail.

Upvotes: 8

Related Questions