Permissions to run job with script and SQLCMD

  • I have a simple little script that runs a job on a server:

    SQLCMD -S MyServer -Q "USE MSDB EXEC sp_start_job @job_name = 'MyJob'"

    It works fine for me, but I want a user with no other permissions to be able to use it from her desktop. What are the minimum permissions required, and where do they need to be? Assume the code the job calls is in 'MyDB'.

  • create a user with databaseRole :SQLAgentOperatorRole

    -------Bhuvnesh----------
    I work only to learn Sql Server...though my company pays me for getting their stuff done;-)

  • Perfect. That did the job (so to speak). If the job executes sp code that performs data operations on tables in a specific database it appears that the job's permissions handle that. Is that correct?

  • Richard Ray-222778 (12/8/2010)


    If the job executes sp code that performs data operations on tables in a specific database it appears that the job's permissions handle that. Is that correct?

    You need to map that user with Sp related database and give database role : dbowner

    -------Bhuvnesh----------
    I work only to learn Sql Server...though my company pays me for getting their stuff done;-)

Viewing 4 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply