Need a unique gift idea?
A Pastebin account makes a great Christmas gift
SHARE
TWEET

Untitled

a guest Aug 17th, 2018 61 Never
Upgrade to PRO!
ENDING IN00days00hours00mins00secs
 
  1. /*
  2.     For users that have a need to administer jobs through the SQL Agent
  3.     this script effectively makes them Agent Admins
  4.  
  5.     It assumes that the login is already on the server
  6. */
  7.  
  8. declare @login_name sysname = '<login_name>'
  9.  
  10. USE msdb
  11. if not exists (select 1 from sys.sysusers where name = @login_name)
  12. begin
  13.   exec sp_adduser @loginame = @login_name
  14. end
  15. exec sp_addrolemember @rolename = 'db_datareader', @membername = @login_name
  16. exec sp_addrolemember @rolename = 'SQLAgentOperatorRole',@membername =  @login_name
  17. exec sp_addrolemember @rolename = 'SQLAgentReaderRole',@membername =  @login_name
  18. exec sp_addrolemember @rolename = 'SQLAgentUserRole', @membername = @login_name
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top