Excuting a Stored Procedure from a job step

  • What's the COMMAND syntax to execute a stored procedure from a job step. The stored procedure is alredy saved in the database.

    Looks like it needs to know the server name, database name, user. etc..

    This is what I'm doing from the only step that I have in my job:

    EXEC p_test_cmd /Uuser /Sserver

    Thanks.

  • In the Job Step,

    Give a Step Name,

    Then under type select Transact SQL

    Under database choose the database name where the stored proc exists,

    Under Command have this code..

    EXEC p_test_cmd

    Regarding the User, right click on the job, under owner choose the owner.

    You need not specify a Server Name if you are executing the SQL Job on the same server where database exists.


    Bru Medishetty

    Blog -- LearnSQLWithBru

    Join on Facebook Page Facebook.comLearnSQLWithBru

    Twitter -- BruMedishetty

  • Works now. Thanks.!

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

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