Thursday, March 8, 2012

assign role of SQLAgentOperatorRole

Hi there,

How can I assign a user role of SQLAgentOperatorRole.

I tried with sp_addsrvrolemember but failed.

Thanks

Rahul

This should be a DB-scoped role, not a server-scoped role. You should use sp_addrolemember (http://msdn2.microsoft.com/en-us/library/ms187750(SQL.90).aspx) instead.

Please refer to SQL Server Agent BOL for further details and let us know if you have further questions

-Raul Garcia

SDE/T

SQL Server Engine

|||

Cant get it through.

I always thought Agent roles should be Server level role.

Any way : sp_addrolemember SQLAgentOperatorRole, @.username didnt work either.

thanks

Rahul

|||

Agenet principals are scoped to msdb; make sure you are running the statement from msdb DB. For example:

use [msdb]

go

-- The code where @.userName is declared & set

-- ...

EXEC sp_addrolemember 'SQLAgentOperatorRole', @.userName

go

If you still have problems let us know, and please include the error number and message in order to help us understand the nature of the fauilure.

-Raul Garcia

SDE/T

SQL Server Engine

No comments:

Post a Comment