2
Answers

how to find mamber name in sp_addrolemamber

Photo of snowal raj

snowal raj

8y
732
1
i need to add user for 'DatabaseMailUserRole'
This Is a Query for add role
sp_addrolemember @rolename = 'DatabaseMailUserRole'    ,@membername = '<database user>';
But what is @memberName and how to find my @membername
 
       

Answers (2)

0
Photo of Nitin Sontakke
137 13.6k 15.4k 8y
Use following command in SQL Server Management Studio to know your login name:
 
select suser_sname()
 
0
Photo of Nitin Sontakke
137 13.6k 15.4k 8y
While I am not 100% sure, it would be any user name in current database as stated in help itself.
 
This is a security feature. Typically, you should have a separate user for such tasks and that user should be member of this role. This user could be a SQL Server user or a Windows user - if your server is configured for mixed mode authentication.
 
This way other users (who are obviously are not member of this role) will not be able to send the mail (either deliberately or inadvertently).
 
Hope you get the point.