How to run a SQL job using different account.

  • Hi I have a job that needs to execute with different account. I figured i need a proxy so i have created one.

    Now i need to configure a job that runs a store procedure using that proxy account.

    Can some please help me with steps

  • I created a job with a step which has OperatingSystem(CMDEXEC) and run as DOMAIN\MYACCOUNT.

    SQLCMD -q "SQLOPSDB.DBO.sp_now"

    But now the job is not finishing as the above command does not have EXIT command. Can someone please help me with syntax to run above query with EXIT Command.

  • Mac1986 (7/21/2014)


    I created a job with a step which has OperatingSystem(CMDEXEC) and run as DOMAIN\MYACCOUNT.

    SQLCMD -q "SQLOPSDB.DBO.sp_now"

    But now the job is not finishing as the above command does not have EXIT command. Can someone please help me with syntax to run above query with EXIT Command.

    Why are you shelling out to run a stored procedure? And, why on this good green Earth would you name a stored procedure with the system prefix of "sp_"?

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)

  • Jeff Moden (7/21/2014)


    Mac1986 (7/21/2014)


    I created a job with a step which has OperatingSystem(CMDEXEC) and run as DOMAIN\MYACCOUNT.

    SQLCMD -q "SQLOPSDB.DBO.sp_now"

    But now the job is not finishing as the above command does not have EXIT command. Can someone please help me with syntax to run above query with EXIT Command.

    Why are you shelling out to run a stored procedure? And, why on this good green Earth would you name a stored procedure with the system prefix of "sp_"?

    +10

    Inquiring minds want to know.

    Jason...AKA CirqueDeSQLeil
    _______________________________________________
    I have given a name to my pain...MCM SQL Server, MVP
    SQL RNNR
    Posting Performance Based Questions - Gail Shaw[/url]
    Learn Extended Events

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

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