<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Dates &amp; Time on Andy M Mallon - AM²</title><link>https://am2.co/tag/dates-time/</link><description>Recent content in Dates &amp; Time 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/tag/dates-time/index.xml" rel="self" type="application/rss+xml"/><item><title>Consuming SQL Agent dates &amp; durations</title><link>https://am2.co/2025/03/07/consuming-sql-agent-dates-durations/</link><pubDate>Fri, 07 Mar 2025 16:17:43 -0500</pubDate><guid>https://am2.co/2025/03/07/consuming-sql-agent-dates-durations/</guid><description>&lt;p&gt;&lt;a href="https://www.youtube.com/watch?v=vBynw9Isr28"&gt;&lt;img src="https://am2.co/wp-content/uploads/StopWatch-300x300.png" alt="" width="300" height="300" class="alignright size-medium wp-image-57887" /&gt;&lt;/a&gt;&#10;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;</description></item><item><title>Not all stats should be auto-updated</title><link>https://am2.co/2024/08/29/not-all-stats-should-be-auto-updated/</link><pubDate>Thu, 29 Aug 2024 11:19:07 -0400</pubDate><guid>https://am2.co/2024/08/29/not-all-stats-should-be-auto-updated/</guid><description>&lt;p&gt;&lt;a href="https://www.youtube.com/watch?v=CO__LF_m_O8"&gt;&lt;img src="https://am2.co/wp-content/uploads/StatsDog-300x300.png" alt="" width="300" height="300" class="alignright size-medium wp-image-53810" /&gt;&lt;/a&gt;Statistics auto-updates are generally a good thing&amp;ndash;auto-update of &lt;a href="https://learn.microsoft.com/en-us/sql/relational-databases/statistics/statistics?view=sql-server-ver16" rel="noopener" target="_blank"&gt;statistics&lt;/a&gt; is the default behavior in SQL Server. Having the freshest information about the data &amp;ldquo;shape&amp;rdquo; helps to inform the best selection of an execution plan for queries.&lt;/p&gt;&#10;&lt;h2 id="except-for-when-it-doesnt"&gt;Except for when it doesn&amp;rsquo;t.&lt;/h2&gt;&#10;&lt;h3 id="because-it-depends"&gt;Because It Depends™️&lt;/h3&gt;&#10;&lt;p&gt;Let&amp;rsquo;s talk about the trade-offs.&lt;/p&gt;</description></item><item><title>Why are there no "Daylight Time" time zones in SQL Server?</title><link>https://am2.co/2021/10/21/why-are-there-no-daylight-time-time-zones-in-sql-server/</link><pubDate>Thu, 21 Oct 2021 23:11:06 -0400</pubDate><guid>https://am2.co/2021/10/21/why-are-there-no-daylight-time-time-zones-in-sql-server/</guid><description>&lt;p&gt;&lt;a href="https://dba.stackexchange.com/q/301484/52344"&gt;&lt;img src="https://am2.co/images/stack-exchange-question-mark.svg" alt="Question on Stack Exchange" width="96" height="96" class="stack-exchange-question-icon" /&gt;&lt;/a&gt;&lt;/p&gt;&#10;&lt;h2 id="question"&gt;Question&lt;/h2&gt;&#10;&lt;p&gt;I am converting the times of some datetimeoffset columns from UTC to Eastern. I am doing this via the command&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-sql" data-lang="sql"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="k"&gt;UPDATE&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;MyTable&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="k"&gt;SET&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;MyColumn&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;MyColumn&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="k"&gt;AT&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;TIME&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="k"&gt;ZONE&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;Eastern Standard Time&amp;#39;&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;This seemed to be working correctly (times were shifted 4 hours earlier and now have a -04:00 offset, exactly what I wanted), but then I realized that it's not EST, it's EDT right now.&lt;/p&gt;</description></item><item><title>Question Regarding ISDATE Function and DATENAME Functions</title><link>https://am2.co/2021/07/01/question-regarding-isdate-function-and-datename-functions/</link><pubDate>Thu, 01 Jul 2021 23:50:20 -0400</pubDate><guid>https://am2.co/2021/07/01/question-regarding-isdate-function-and-datename-functions/</guid><description>&lt;p&gt;&lt;a href="https://dba.stackexchange.com/q/295143/52344"&gt;&lt;img src="https://am2.co/images/stack-exchange-question-mark.svg" alt="Question on Stack Exchange" width="96" height="96" class="stack-exchange-question-icon" /&gt;&lt;/a&gt;&lt;/p&gt;&#10;&lt;h2 id="question"&gt;Question&lt;/h2&gt;&#10;&lt;p&gt;We have had an issue this morning with a report failing due to the following error:&lt;/p&gt;&#10;&lt;p&gt;&amp;quot;Conversion failed when converting date and/or time from character string&amp;quot;&lt;/p&gt;&#10;&lt;p&gt;The issue is that in the database we had a value (in a VARCHAR field) of: '31.07/2021'&lt;/p&gt;</description></item><item><title>SQL Server 2012 equivalent of AT TIME ZONE capability</title><link>https://am2.co/2021/06/30/sql-server-2012-equivalent-of-at-time-zone-capability/</link><pubDate>Wed, 30 Jun 2021 22:11:31 -0400</pubDate><guid>https://am2.co/2021/06/30/sql-server-2012-equivalent-of-at-time-zone-capability/</guid><description>&lt;p&gt;&lt;a href="https://dba.stackexchange.com/q/295079/52344"&gt;&lt;img src="https://am2.co/images/stack-exchange-question-mark.svg" alt="Question on Stack Exchange" width="96" height="96" class="stack-exchange-question-icon" /&gt;&lt;/a&gt;&lt;/p&gt;&#10;&lt;h2 id="question"&gt;Question&lt;/h2&gt;&#10;&lt;p&gt;Is there a way in SQL Server 2012 to get what the server time zone would be on a particular date/time? In SQL Server 2016, you have &lt;code&gt;AT TIME ZONE&lt;/code&gt;, but that's not available in 2012. I have a &lt;code&gt;datetimeoffset&lt;/code&gt; and I need to convert it to the server's timezone (on that date) before truncating it to &lt;code&gt;datetime&lt;/code&gt;. &lt;code&gt;SWITCHOFFSET&lt;/code&gt; only works if you know the offset, but for servers that change their timezone twice yearly, the offset will flip back and forth.&lt;/p&gt;</description></item><item><title>Job management: How to get the next running date by querying MSDB</title><link>https://am2.co/2020/11/27/job-management-how-to-get-the-next-running-date-by-querying-msdb/</link><pubDate>Fri, 27 Nov 2020 10:10:17 -0500</pubDate><guid>https://am2.co/2020/11/27/job-management-how-to-get-the-next-running-date-by-querying-msdb/</guid><description>&lt;p&gt;&lt;a href="https://dba.stackexchange.com/q/280429/52344"&gt;&lt;img src="https://am2.co/images/stack-exchange-question-mark.svg" alt="Question on Stack Exchange" width="96" height="96" class="stack-exchange-question-icon" /&gt;&lt;/a&gt;&lt;/p&gt;&#10;&lt;h2 id="question"&gt;Question&lt;/h2&gt;&#10;&lt;p&gt;Table &lt;code&gt;sysjobschedules&lt;/code&gt; contains 2 columns &lt;code&gt;next_run_date&lt;/code&gt; and &lt;code&gt;next_run_time&lt;/code&gt;. With the help of &lt;code&gt;sysschedules&lt;/code&gt; and column &lt;code&gt;enable&lt;/code&gt; it should be easy to determine the next running date/time of a specific job.&lt;/p&gt;&#10;&lt;p&gt;However, when you change a schedule, &lt;code&gt;sysjobschedules&lt;/code&gt; is only refreshed 20 minutes after alteration by the Sql Server Agent.&lt;/p&gt;</description></item><item><title>Replication of only updates and inserts</title><link>https://am2.co/2020/10/14/replication-of-only-updates-and-inserts/</link><pubDate>Wed, 14 Oct 2020 16:01:08 -0400</pubDate><guid>https://am2.co/2020/10/14/replication-of-only-updates-and-inserts/</guid><description>&lt;p&gt;&lt;a href="https://dba.stackexchange.com/q/278071/52344"&gt;&lt;img src="https://am2.co/images/stack-exchange-question-mark.svg" alt="Question on Stack Exchange" width="96" height="96" class="stack-exchange-question-icon" /&gt;&lt;/a&gt;&lt;/p&gt;&#10;&lt;h2 id="question"&gt;Question&lt;/h2&gt;&#10;&lt;p&gt;I have two sql servers, in the first I want to keep the data from the last three months and in the second I want to keep all the data with the purpose of getting historical reports.&#10;I know how to do a transactional replica but I don't know how to replicate only the inserts and updates, I don't want to replicate the deletions.&lt;/p&gt;</description></item><item><title>sp_update_schedule says @schedule_id does not exist</title><link>https://am2.co/2020/10/06/sp_update_schedule-says-schedule_id-does-not-exist/</link><pubDate>Tue, 06 Oct 2020 12:53:39 -0400</pubDate><guid>https://am2.co/2020/10/06/sp_update_schedule-says-schedule_id-does-not-exist/</guid><description>&lt;p&gt;&lt;a href="https://dba.stackexchange.com/q/276609/52344"&gt;&lt;img src="https://am2.co/images/stack-exchange-question-mark.svg" alt="Question on Stack Exchange" width="96" height="96" class="stack-exchange-question-icon" /&gt;&lt;/a&gt;&lt;/p&gt;&#10;&lt;h2 id="question"&gt;Question&lt;/h2&gt;&#10;&lt;p&gt;I wrote a script that reads job schedules from &lt;code&gt;msdb.dbo.sysschedules&lt;/code&gt; and runs &lt;code&gt;sp_update_schedule&lt;/code&gt; to change the &lt;code&gt;active_start_time&lt;/code&gt; for a given subset of jobs. In each case, &lt;code&gt;sp_update_schedule&lt;/code&gt; fails with the message &amp;quot;The specified @schedule_id('xxx') does not exist&amp;quot;. (MessageID 14262, Severity 16)&lt;/p&gt;</description></item><item><title>How to create date buckets in T-SQL</title><link>https://am2.co/2019/10/28/how-to-create-date-buckets-in-t-sql/</link><pubDate>Mon, 28 Oct 2019 10:00:47 -0400</pubDate><guid>https://am2.co/2019/10/28/how-to-create-date-buckets-in-t-sql/</guid><description>&lt;p&gt;&lt;a href="https://www.youtube.com/watch?v=zYY6Q4nRTS4" rel="noopener noreferrer" target="_blank"&gt;&lt;img src="https://am2.co/wp-content/uploads/StockSnap_MHIAORM8Q6.jpg" alt="" width="512" height="341" class="alignright size-full wp-image-2263" /&gt;&lt;/a&gt;&#10;I was fiddling around with some data, looking at making a quick aging report. I probably should have reached for &lt;a href="https://powerbi.microsoft.com/en-us/desktop/" rel="noopener noreferrer" target="_blank"&gt;Power BI Desktop&lt;/a&gt;, but sometimes I can be stubborn, and I wanted to get my T-SQL to work&amp;ndash;if nothing else to figure out how to make it work.&lt;/p&gt;</description></item><item><title>convert sql-excel date to recognizable format</title><link>https://am2.co/2019/10/26/convert-sql-excel-date-to-recognizable-format/</link><pubDate>Sat, 26 Oct 2019 10:27:37 -0400</pubDate><guid>https://am2.co/2019/10/26/convert-sql-excel-date-to-recognizable-format/</guid><description>&lt;p&gt;&lt;a href="https://superuser.com/q/1496171/630094"&gt;&lt;img src="https://am2.co/images/stack-exchange-question-mark.svg" alt="Question on Stack Exchange" width="96" height="96" class="stack-exchange-question-icon" /&gt;&lt;/a&gt;&lt;/p&gt;&#10;&lt;h2 id="question"&gt;Question&lt;/h2&gt;&#10;&lt;p&gt;I have a large csv file(1.1G) exported from SQL Server. I would like to do data wrangling in python, but I had a few problems doing this. The original csv file dates look like this &lt;code&gt;00:07.5, 00:08.3, 00:48.7&lt;/code&gt;, I can manually convert them to &lt;code&gt;1/12/2015 12:00:07 am, 1/12/2015 12:00:08 am, 1/12/2015 12:00:49 am&lt;/code&gt; in excel by formatting the entire column to make it in &lt;code&gt;d/m/yy h:mm:ss&lt;/code&gt;, but sometimes output is weird like &lt;code&gt;100:00:00&lt;/code&gt;, or it just kept the time but not the dates, when I finally successfully did this, I noticed that the file size had shrank to &lt;code&gt;36.6 MB&lt;/code&gt; from &lt;code&gt;1.1G&lt;/code&gt;. I received the excel notification:&lt;/p&gt;</description></item><item><title>Updates to the Data Blogger Resource Kit</title><link>https://am2.co/2019/10/09/updates-to-the-data-blogger-resource-kit/</link><pubDate>Wed, 09 Oct 2019 10:31:46 -0400</pubDate><guid>https://am2.co/2019/10/09/updates-to-the-data-blogger-resource-kit/</guid><description>&lt;p&gt;&lt;a href="https://www.youtube.com/watch?v=8pQav7DIJf4" rel="noopener noreferrer" target="_blank"&gt;&lt;img src="https://am2.co/wp-content/uploads/DataBlogger.png" alt="" width="367" height="429" class="alignright size-full wp-image-1867" /&gt;&lt;/a&gt;&#10;Earlier this year, I published &lt;a href="https://am2.co/2019/05/27/data-blogger-resource-kit/"&gt;the first crack&lt;/a&gt; at a &lt;a href="http://datablogger.info" rel="noopener noreferrer" target="_blank"&gt;Data Blogger Resource Kit&lt;/a&gt;. When I initially created the kit, I wasn&amp;rsquo;t quite sure exactly what direction I would go with it. In the months since, I&amp;rsquo;ve started to get a better idea of where I want to go, and I&amp;rsquo;ve collected some additional resources that might be helpful for folks who are bloggers or who are interested in becoming bloggers.&lt;/p&gt;</description></item><item><title>Code to purge data based on creation date</title><link>https://am2.co/2019/04/04/code-to-purge-data-on-creation-date/</link><pubDate>Thu, 04 Apr 2019 08:30:16 -0400</pubDate><guid>https://am2.co/2019/04/04/code-to-purge-data-on-creation-date/</guid><description>&lt;figure class="wp-caption alignright" style="max-width:678px"&gt;&lt;a href="https://www.youtube.com/watch?v=nHlJODYBLKs"&gt;&lt;img src="https://am2.co/wp-content/uploads/MarieKondoData-678x381.png" alt="" width="678" height="381" class="size-mh-magazine-lite-content wp-image-1743" /&gt;&lt;/a&gt; Only one thing can spark more joy than cleaning up old data. Doggos. &lt;/figure&gt;&#10;Yesterday, &lt;a href="https://am2.co/2019/04/03/purging-data-with-batched-deletes/"&gt;I talked about batching deletes&lt;/a&gt;, and the day before I talked about &lt;a href="https://am2.co/2019/04/02/the-thrill-of-purging-old-data/"&gt;how much I like to delete data&lt;/a&gt;, and why it's necessary to do it, despite being a data packrat.&#10;&lt;p&gt;Today, let&amp;rsquo;s look at just one scenario, and how I like to handle it. In my experience, this is one of the most common purge requirements (and probably the easiest), so first, let&amp;rsquo;s look at the business requirements.&lt;/p&gt;</description></item><item><title>Updated shortcuts cheat sheet -- Now with Azure Data Studio</title><link>https://am2.co/2018/02/08/updated-cheat-sheet/</link><pubDate>Thu, 08 Feb 2018 21:05:46 -0500</pubDate><guid>https://am2.co/2018/02/08/updated-cheat-sheet/</guid><description>&lt;blockquote&gt;&lt;em&gt;Updated (2018-09-24): SQL Ops Studio is now generally available, and has been renamed Azure Data Studio. I've updated the cheat sheet to reflect the name change, but the shortcuts remain the same. Feel free to grab the updated PDF with the new label, or keep the old one to prove your &lt;a href="https://en.wikipedia.org/wiki/O.G._Original_Gangster" rel="noopener noreferrer" target="_blank"&gt;OG status&lt;/a&gt;.&lt;/em&gt;&lt;/blockquote&gt;&#10;&lt;p&gt;Nearly two year ago, I &lt;a href="https://am2.co/2016/03/07/shortcuts-cheat-sheet/"&gt;first published my Shortcuts cheat sheet&lt;/a&gt;. Since then, thousands of people have downloaded it. I&amp;rsquo;ll be the first to admit that I didn&amp;rsquo;t expect it to be as much of a hit as it has been. When I give my &lt;a href="https://am2.co/2017/09/20/shortcuts-recording/"&gt;one-hour talk&lt;/a&gt; in person, I bring card stock handouts of my cheat sheets, too. I also ask people for &lt;em&gt;their&lt;/em&gt; favorite shortcuts, and I&amp;rsquo;ve learned some great new hidden gems.&lt;/p&gt;</description></item><item><title>Converting date stored as a varchar</title><link>https://am2.co/2017/04/06/converting-date-stored-as-a-varchar/</link><pubDate>Thu, 06 Apr 2017 10:00:51 -0400</pubDate><guid>https://am2.co/2017/04/06/converting-date-stored-as-a-varchar/</guid><description>&lt;p&gt;&lt;a href="https://dba.stackexchange.com/q/169287/52344"&gt;&lt;img src="https://am2.co/images/stack-exchange-question-mark.svg" alt="Question on Stack Exchange" width="96" height="96" class="stack-exchange-question-icon" /&gt;&lt;/a&gt;&lt;/p&gt;&#10;&lt;h2 id="question"&gt;Question&lt;/h2&gt;&#10;&lt;p&gt;I'm creating a query that has a column of dates stored as a VARCHAR in the format DD-MMM-YYYY.&lt;/p&gt;&#10;&lt;p&gt;Could you tell me how I can convert this into date format please?&lt;/p&gt;&#10;&lt;p&gt;I don't want to alter the original table in any way, as it's not mine to tinker!&lt;/p&gt;</description></item><item><title>How often to update SQL Server?</title><link>https://am2.co/2017/01/02/how-often-to-update-sql-server/</link><pubDate>Mon, 02 Jan 2017 19:10:39 -0500</pubDate><guid>https://am2.co/2017/01/02/how-often-to-update-sql-server/</guid><description>&lt;p&gt;&lt;a href="https://dba.stackexchange.com/q/159754/52344"&gt;&lt;img src="https://am2.co/images/stack-exchange-question-mark.svg" alt="Question on Stack Exchange" width="96" height="96" class="stack-exchange-question-icon" /&gt;&lt;/a&gt;&lt;/p&gt;&#10;&lt;h2 id="question"&gt;Question&lt;/h2&gt;&#10;&lt;p&gt;I am a new DBA at a company that has never had a DBA before me. SQL Servers are never upgraded unless it is part of a Windows Update on the server. Service Packs (or CUs) are never installed. We have a mix of versions from 2000 to 2014.&lt;/p&gt;</description></item><item><title>I have 3 tables with dates to which I want to join to a date dimension table but it is returning many duplicates with left joins</title><link>https://am2.co/2016/08/16/i-have-3-tables-with-dates-to-which-i-want-to-join-to-a-date-dimension-table-but-it-is-returning-many-duplicates-with-left-joins/</link><pubDate>Tue, 16 Aug 2016 11:55:03 -0400</pubDate><guid>https://am2.co/2016/08/16/i-have-3-tables-with-dates-to-which-i-want-to-join-to-a-date-dimension-table-but-it-is-returning-many-duplicates-with-left-joins/</guid><description>&lt;p&gt;&lt;a href="https://stackoverflow.com/q/38665777/1948808"&gt;&lt;img src="https://am2.co/images/stack-exchange-question-mark.svg" alt="Question on Stack Exchange" width="96" height="96" class="stack-exchange-question-icon" /&gt;&lt;/a&gt;&lt;/p&gt;&#10;&lt;h2 id="question"&gt;Question&lt;/h2&gt;&#10;&lt;p&gt;I have 4 tables with dates to which I want to join to a date dimension table but it is returning many duplicates with left joins.&lt;/p&gt;&#10;&lt;p&gt;Tables are basically a date field which I want to count.&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-sql" data-lang="sql"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;mdate&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;datetime&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;mordate&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nb"&gt;varchar&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;10&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;&lt;span class="n"&gt;fteam&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nb"&gt;varchar&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;20&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;sdate&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;datetime&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="n"&gt;fteam&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nb"&gt;varchar&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;20&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;bdate&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;datetime&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="n"&gt;fteam&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nb"&gt;varchar&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;20&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;These are actually one table with the separate dates which I am joining 3 times to the dimension table to get one dataset. Also this table&lt;/p&gt;</description></item><item><title>Using DateTime Variable In Where Clause</title><link>https://am2.co/2016/03/30/using-datetime-variable-in-where-clause/</link><pubDate>Wed, 30 Mar 2016 15:22:09 -0400</pubDate><guid>https://am2.co/2016/03/30/using-datetime-variable-in-where-clause/</guid><description>&lt;p&gt;&lt;a href="https://dba.stackexchange.com/q/133840/52344"&gt;&lt;img src="https://am2.co/images/stack-exchange-question-mark.svg" alt="Question on Stack Exchange" width="96" height="96" class="stack-exchange-question-icon" /&gt;&lt;/a&gt;&lt;/p&gt;&#10;&lt;h2 id="question"&gt;Question&lt;/h2&gt;&#10;&lt;p&gt;I am trying to pull all data where a sale date is &gt;= to a certain datetime. When I execute my query I get an error of:&lt;/p&gt;&#10;&lt;blockquote&gt;&#10; &lt;p&gt;Msg 241, Level 16, State 1, Line 15&lt;br&gt;&#10; Conversion failed when converting date and/or time from character string.&lt;/p&gt;&#10;&lt;/blockquote&gt;</description></item><item><title>sp_autostats: object-level auto update statistics</title><link>https://am2.co/2015/12/15/sp_autostats/</link><pubDate>Tue, 15 Dec 2015 11:00:00 -0500</pubDate><guid>https://am2.co/2015/12/15/sp_autostats/</guid><description>&lt;p&gt;In SQL Server, auto-update statistics is a database level setting. It&amp;rsquo;s right  there:&lt;/p&gt;&#10;&lt;p&gt;&lt;a href="https://am2.co/wp-content/uploads/2015/12/sp_autostats1.png" rel="attachment wp-att-249"&gt;&lt;img class="alignnone wp-image-249 size-full" src="https://am2.co/wp-content/uploads/2015/12/sp_autostats1.png" alt="Auto Update Statistics" width="901" height="200" /&gt;&lt;/a&gt;&lt;/p&gt;&#10;&lt;p&gt;I&amp;rsquo;m not going to say whether I think Auto Update Statistics should be on or off. Instead, I&amp;rsquo;m going to argue that there are definitely scenarios when you want to have this on AND there are scenarios where you want it turned off. Can you really have this both ways? Absolutely.&lt;/p&gt;</description></item></channel></rss>