Adds an account as a database role member of the SQL Server in the current database. Then the account gets rights connected with the appropriate role in the SQL Server.
[ @rolename = ] 'role'
[ @membername = ] 'security_acount'
|@rolename ||Database role of the SQL Server into which the account will be added (db_ddladmin, db_datareader, db_datawriter).|
|@membername ||Account created in the certain database (sp_grantdbaccess) that will be added into the database role.|
The database role holds for the certain database. The fixed role of the SQL Server holds globally in the SQL Server.
Adds the account 'pm_reader' into the database role of the SQL Server 'db_datareader' (this account can be used for reading data of the appropriate database).
EXEC sp_addrolemember 'db_datareader', 'pm_reader'