February 4, 2016 at 5:44 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/
February 4, 2016 at 5:58 am
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.
How to post a question to get the most help http://www.sqlservercentral.com/articles/Best+Practices/61537
February 4, 2016 at 6:03 am
Try this filter:
WHERE run_time BETWEEN 0 AND 300
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