jeudi 26 mars 2015

How can I map a login to a database using T-SQL (not SSMS)


I'm writing a program that requires me to assign all permissions and everything in code. I have gotten stuck in this part:


enter image description here


I just want to do the equivalent of clicking the little box under "Map" for the msdb database and assigning that user to SqlAgentUser role. I need a user to be able to add/edit SQL Server Agent jobs. I can get the settings right using SSMS but I can't for the life of me figure out how to do it in raw SQL.


I've looked into ALTER LOGIN but I'm not seeing anything that does what I need. I suspect I just don't know the correct terms to Google. I don't normally do this sort of thing.


Any help is much appreciated!





Aucun commentaire:

Enregistrer un commentaire