Make the stored procedure to run daily

  • My requirement is "Make the stored procedure to run daily without using any JOBs.

    Thanks in advance.

  • What is the problem in using a JOB to execute? After all, jobs are meant to there for this type of actions.

    Well, other option I know, is to create another procedure & mark it as auto start (by using the procedure sp_procoption). In that procedure, you write an infinite loop and an if clause that checks the time and executes the main procedure.

    --Ramesh


  • put the stored procedure in an infinite loop?

    in the loop, put something like

    WAITFOR DELAY '23:59:59' so that it will only run once a day.

    😀

  • v-makath (2/10/2009)


    My requirement is "Make the stored procedure to run daily without using any JOBs.

    Thanks in advance.

    lots of methods

    - use jobs

    - write a small application and put that in the windows scheduler

    - create a window service

    etc

    kshitij kumar
    kshitij@krayknot.com
    www.krayknot.com

  • I do not know maybe you can create a vbscript to call the sql server proc?

  • v-makath (2/10/2009)


    My requirement is "Make the stored procedure to run daily without using any JOBs.

    Why the restriction against using jobs?

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass
  • I understand the requirement as I have a similar situation. I.e., we are a SaaS company and we have numerous customer databases that are all the same. So we don't want to create a scheduled job in each database for these sorts of things and have it launched by the SQL Server agent.

    Therefore, we have an external process (job) that iterates through each database and runs the appropriate stored procedure. The external "job" is fired by a job scheduler (e.g., Scheduled Task) on a separate machine (i.e., not the SQL Server machine) whose purpose is to run various scheduled jobs. The machine is a client to SQL Server.

    The "code" (job) that executes the stored procedure is written in a variety of languages. The simplist being VBScript using ADO with OLD-DB. Sometimes it is a .Net program written in C#. Lately, we are using Windows PowerShell as it is the "official" scripting language for Windows Server 2008. Which BTW, is real nice as it gives you all of .Net within a scripting environment. And PowerShell 2.0 (still in CTP) has a lot of enhancements including Try...Catch.

    With this type of environment, the "jobs" can be custom tailored, via the code, as to logging (log files), alerts (Windows Event Logging), etc.


    [font="Arial Narrow"](PHB) I think we should build an SQL database. (Dilbert) What color do you want that database? (PHB) I think mauve has the most RAM.[/font]

Viewing 7 posts - 1 through 6 (of 6 total)

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