Select Statement retun records between 12:AM and 12:03 AM

  • I'm trying to perform a Select Statement to a record between 12:AM and 12:03 AM

    select

    j.name as 'JobName',

    run_date,

    run_time,

    msdb.dbo.agent_datetime(run_date, run_time) as 'RunDateTime'

    From msdb.dbo.sysjobs j

    INNER JOIN msdb.dbo.sysjobhistory h

    ON j.job_id = h.job_id

    where j.enabled = 1 --Only Enabled Jobs

    AND j.name = 'CA CAT Alert Email'

    --AND run_date <= '2006-02-04'

    order by JobName, RunDateTime d

    For better, quicker answers on T-SQL questions, click on the following...
    http://www.sqlservercentral.com/articles/Best+Practices/61537/

    For better answers on performance questions, click on the following...
    http://www.sqlservercentral.com/articles/SQLServerCentral/66909/

  • Welsh Corgi (2/4/2016)


    I'm trying to perform a Select Statement to a record between 12:AM and 12:03 AM

    select

    j.name as 'JobName',

    run_date,

    run_time,

    msdb.dbo.agent_datetime(run_date, run_time) as 'RunDateTime'

    From msdb.dbo.sysjobs j

    INNER JOIN msdb.dbo.sysjobhistory h

    ON j.job_id = h.job_id

    where j.enabled = 1 --Only Enabled Jobs

    AND j.name = 'CA CAT Alert Email'

    --AND run_date <= '2006-02-04'

    order by JobName, RunDateTime d

    We're going to need a lot than that to help. You've been around long enough to know how to ask a question properly.


    On two occasions I have been asked, "Pray, Mr. Babbage, if you put into the machine wrong figures, will the right answers come out?" ... I am not able rightly to apprehend the kind of confusion of ideas that could provoke such a question.
    —Charles Babbage, Passages from the Life of a Philosopher

    How to post a question to get the most help http://www.sqlservercentral.com/articles/Best+Practices/61537

  • Try this filter:

    WHERE run_time BETWEEN 0 AND 300

    “Write the query the simplest way. If through testing it becomes clear that the performance is inadequate, consider alternative query forms.” - Gail Shaw

    For fast, accurate and documented assistance in answering your questions, please read this article.
    Understanding and using APPLY, (I) and (II) Paul White
    Hidden RBAR: Triangular Joins / The "Numbers" or "Tally" Table: What it is and how it replaces a loop Jeff Moden

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

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