<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>2025 on Andy M Mallon - AM²</title><link>https://am2.co/2025/</link><description>Recent content in 2025 on Andy M Mallon - AM²</description><generator>Hugo</generator><language>en-US</language><lastBuildDate>Fri, 07 Mar 2025 16:17:43 -0500</lastBuildDate><atom:link href="https://am2.co/2025/index.xml" rel="self" type="application/rss+xml"/><item><title>Consuming SQL Agent dates &amp; durations</title><link>https://am2.co/2025/03/consuming-sql-agent-dates-durations/</link><pubDate>Fri, 07 Mar 2025 16:17:43 -0500</pubDate><guid>https://am2.co/2025/03/consuming-sql-agent-dates-durations/</guid><description>&lt;p&gt;SQL Agent&amp;rsquo;s schema is older than me. It handles dates, times, and durations like it&amp;rsquo;s 1980 by using integers instead of date/time data types. My buddy Aaron Bertrand talks more about &lt;a href="https://sqlblog.org/dates" target="_blank"&gt;Dating Responsibly&lt;/a&gt; so that you can have a good datetime with your own database.&lt;/p&gt;&#10;&lt;p&gt;I was writing a query to pull recent job failures from SQL Agent&amp;rsquo;s &lt;code&gt;msdb&lt;/code&gt; job history, and knew that I didn&amp;rsquo;t want to deal with the wonky date/time formats. Specifically, I was querying &lt;code&gt;msdb.dbo.sysjobhistory&lt;/code&gt; to find the Start Time, End Time, and Duration of job runs that failed. If you aren&amp;rsquo;t familiar with that table, you can look at it over in &lt;a href="https://learn.microsoft.com/en-us/sql/relational-databases/system-tables/dbo-sysjobhistory-transact-sql" target="_blank"&gt;the docs&lt;/a&gt;.&lt;/p&gt;</description></item></channel></rss>