convert update query into stored procedure

  • Hey,

    Sorry for the layman's question but I am not too familiar with stored procedures. Anyone know the best way to convert the below query to run every 30 minutes M-F from 10-6? I need the actual code as I do not have access to utilize enterprise manager.

    Thanks

    Joe

    UPDATE EJOB

    SET EJROOM =

    CASE

    WHEN ebase.Ebflxid IN(SELECT distinct ebase.ebflxid FROM EBASE LEFT JOIN ejob ON ebflxid = ejsupervisorflxideb WHERE ebdateend IS NULL AND ejdateend IS NULL AND ebrectype = 'ebas' AND NOT(ejsupervisor IS NULL))

    THEN 'Y'

    WHEN

    ebase.Ebflxid NOT IN(SELECT distinct ebase.ebflxid FROM EBASE LEFT JOIN ejob ON ebflxid = ejsupervisorflxideb WHERE ebdateend IS NULL AND ejdateend IS NULL AND ebrectype = 'ebas' AND NOT(ejsupervisor IS NULL)) THEN '' ELSE '' END

    FROM EBASE, EJOB

    WHERE EBASE.EBFLXID = EJOB.EJFLXIDEB AND EJDATEEND IS NULL AND EBDATEEND IS NULL

  • With a stored procedure you won't be able to schedulle the execution of the query.

    You can do it with a Job from SQL, or from outside using a schedulle task that runs a osql command.

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

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