<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>2020 on Andy M Mallon - AM²</title><link>https://am2.co/2020/</link><description>Recent content in 2020 on Andy M Mallon - AM²</description><generator>Hugo</generator><language>en-US</language><lastBuildDate>Mon, 28 Dec 2020 12:00:14 -0500</lastBuildDate><atom:link href="https://am2.co/2020/index.xml" rel="self" type="application/rss+xml"/><item><title>FAQs about the dissolution of PASS</title><link>https://am2.co/2020/12/faqs-about-the-dissolution-of-pass/</link><pubDate>Mon, 28 Dec 2020 12:00:14 -0500</pubDate><guid>https://am2.co/2020/12/faqs-about-the-dissolution-of-pass/</guid><description>&lt;p&gt;In my prior post, I talked about how all signs pointed to it being &lt;a href="https://am2.co/2020/12/08/closing-time/" rel="noopener noreferrer" target="_blank"&gt;Closing Time for PASS&lt;/a&gt;. Since then, &lt;a href="https://web.archive.org/web/20201219035705/https://www.pass.org/PASS-Blog/the-future-of-pass" rel="noopener noreferrer" target="_blank"&gt;PASS has announced&lt;/a&gt; the organization will &amp;ldquo;cease its operations and pursue dissolution.&amp;rdquo;&lt;/p&gt;&#10;&lt;h2 id="tldr"&gt;TL;DR;&lt;/h2&gt;&#10;&lt;p&gt;The short version is that on 15 January, 2021, PASS will shut down all operations, including various technology assets, such as the SQLSaturday site, User Group tools, etc.&lt;/p&gt;</description></item><item><title>Closing Time</title><link>https://am2.co/2020/12/closing-time/</link><pubDate>Tue, 08 Dec 2020 10:59:37 -0500</pubDate><guid>https://am2.co/2020/12/closing-time/</guid><description>&lt;p&gt;This year, I&amp;rsquo;ve written a couple of &lt;a href="https://am2.co/2020/06/24/tech-community-equality-index/" rel="noopener noreferrer" target="_blank"&gt;critical posts&lt;/a&gt; targeted at &lt;a href="https://web.archive.org/web/20201229213804/https://www.pass.org/" rel="noopener noreferrer" target="_blank"&gt;PASS&lt;/a&gt;. If you followed me on Twitter, you know I&amp;rsquo;ve been critical there, too.&lt;/p&gt;&#10;&lt;p&gt;Last week, the PASS Board of Directors had their December meeting. Coming out of that meeting, Mindy Curnutt (&lt;a href="http://mindycurnutt.com/" rel="noopener noreferrer" target="_blank"&gt;blog&lt;/a&gt;) &lt;a href="https://twitter.com/sqlgirl/status/1335328721100828679" rel="noopener noreferrer" target="_blank"&gt;resigned from her position on the board&lt;/a&gt; citing &amp;ldquo;morally wrong&amp;rdquo; decisions and an experience that I will describe as being excluded from participation on the Board. We don&amp;rsquo;t know what those &amp;ldquo;morally wrong&amp;rdquo; decisions are, but I trust Mindy is not over-reacting and her concerns are legitimate.&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/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/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>log send queue size and redo queue size in AG</title><link>https://am2.co/2020/10/log-send-queue-size-and-redo-queue-size-in-ag/</link><pubDate>Mon, 19 Oct 2020 22:44:00 -0400</pubDate><guid>https://am2.co/2020/10/log-send-queue-size-and-redo-queue-size-in-ag/</guid><description>&lt;p&gt;&lt;a href="https://dba.stackexchange.com/q/278324/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 figure out the way to monitor these 2 events&lt;/p&gt;&#10;&lt;ol&gt;&#10;&lt;li&gt;&#10;&lt;p&gt;log send queue size - I can see this in perfmon&lt;/p&gt;&#10;&lt;/li&gt;&#10;&lt;li&gt;&#10;&lt;p&gt;Redo queue size - I can see in dmv but not in perfmon counter&lt;/p&gt;&#10;&lt;/li&gt;&#10;&lt;/ol&gt;&#10;&lt;p&gt;Is there any way of using perfmon so that I can calculate the redo queue size even thought the counter is not available in perfmon?&lt;/p&gt;</description></item><item><title>Is my VM hyperthreaded?</title><link>https://am2.co/2020/10/is-my-vm-hyperthreaded/</link><pubDate>Sun, 18 Oct 2020 23:01:37 -0400</pubDate><guid>https://am2.co/2020/10/is-my-vm-hyperthreaded/</guid><description>&lt;p&gt;&lt;a href="https://superuser.com/q/1595400/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&amp;rsquo;ve been provided a VMware ESXi VM (running Windows Server 2016 SE) with 8 logical processors, but I can&amp;rsquo;t tell whether the VM is hyperthreaded. (This matters for SQL Server.)&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-powershell" data-lang="powershell"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="n"&gt;C:&lt;/span&gt;&lt;span class="p"&gt;\&lt;/span&gt;&lt;span class="n"&gt;Users&lt;/span&gt;&lt;span class="p"&gt;\&lt;/span&gt;&lt;span class="n"&gt;XXXXXXX&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;&lt;span class="n"&gt;wmic&lt;/span&gt; &lt;span class="n"&gt;CPU&lt;/span&gt; &lt;span class="n"&gt;Get&lt;/span&gt; &lt;span class="n"&gt;DeviceID&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="n"&gt;NumberOfCores&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="n"&gt;NumberOfLogicalProcessors&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="n"&gt;DeviceID&lt;/span&gt; &lt;span class="n"&gt;NumberOfCores&lt;/span&gt; &lt;span class="n"&gt;NumberOfLogicalProcessors&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="n"&gt;CPU0&lt;/span&gt; &lt;span class="mf"&gt;2&lt;/span&gt; &lt;span class="mf"&gt;2&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="n"&gt;CPU1&lt;/span&gt; &lt;span class="mf"&gt;2&lt;/span&gt; &lt;span class="mf"&gt;2&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="n"&gt;CPU2&lt;/span&gt; &lt;span class="mf"&gt;2&lt;/span&gt; &lt;span class="mf"&gt;2&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="n"&gt;CPU3&lt;/span&gt; &lt;span class="mf"&gt;2&lt;/span&gt; &lt;span class="mf"&gt;2&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;&lt;code&gt;wmic&lt;/code&gt; says there are four CPUs each with two cores. Does fact that there are two logical processors on each core mean that HT is disabled?&lt;/p&gt;</description></item><item><title>Always On Synchronous Commit Mode With Large Delays</title><link>https://am2.co/2020/10/always-on-synchronous-commit-mode-with-large-delays/</link><pubDate>Sun, 18 Oct 2020 11:37:09 -0400</pubDate><guid>https://am2.co/2020/10/always-on-synchronous-commit-mode-with-large-delays/</guid><description>&lt;p&gt;&lt;a href="https://dba.stackexchange.com/q/278257/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;For SQL Server Enterprise's Always On availability groups in Synchronous Commit mode, is there some amount of latency that can't be exceeded? For example, can it work between very distant data centers, such as between the US and Europe?&lt;/p&gt;</description></item><item><title>Replication of only updates and inserts</title><link>https://am2.co/2020/10/replication-of-only-updates-and-inserts/</link><pubDate>Wed, 14 Oct 2020 16:01:08 -0400</pubDate><guid>https://am2.co/2020/10/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/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/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>Multi-subnet availability group, with mixed MultiSubnetFailover support (Part 2)</title><link>https://am2.co/2020/10/multi-subnet-registerallprovidersip-2/</link><pubDate>Tue, 06 Oct 2020 08:00:55 -0400</pubDate><guid>https://am2.co/2020/10/multi-subnet-registerallprovidersip-2/</guid><description>&lt;p&gt;In &lt;a href="https://am2.co/2020/10/05/multi-subnet-registerallprovidersip-1/"&gt;yesterday&amp;rsquo;s post&lt;/a&gt;, I showed how to configure an availability group (AG) to use the &lt;code&gt;RegisterAllProvidersIP=0&lt;/code&gt; when you can&amp;rsquo;t get clients to connect using the &lt;code&gt;MultiSubnetFailover=true&lt;/code&gt; connection string attribute.&lt;/p&gt;&#10;&lt;p&gt;I mentioned that you have to make some trade-offs when you set &lt;code&gt;RegisterAllProvidersIP=0&lt;/code&gt;, and included this comparison:&lt;/p&gt;</description></item><item><title>Multi-subnet availability group, without MultiSubnetFailover support (Part 1)</title><link>https://am2.co/2020/10/multi-subnet-registerallprovidersip-1/</link><pubDate>Mon, 05 Oct 2020 09:00:48 -0400</pubDate><guid>https://am2.co/2020/10/multi-subnet-registerallprovidersip-1/</guid><description>&lt;p&gt;As a DBA, we have the opportunity &amp;amp; responsibility to build highly available database platforms for use by applications &amp;amp; users. Even if you are a DBA at a small company supporting databases for only internal applications, we are usually still responsible for providing databases as a service for application teams. Sometimes, in order for us to provide the best service, we need application teams to do some work to make use of the super awesome thing we built. And sometimes, getting application teams to make that change isn&amp;rsquo;t easy, or isn&amp;rsquo;t fast, or isn&amp;rsquo;t even possible.&lt;/p&gt;</description></item><item><title>Microsoft Azure hack for social justice</title><link>https://am2.co/2020/10/microsoft-azure-hack-for-social-justice/</link><pubDate>Sun, 04 Oct 2020 11:00:33 -0400</pubDate><guid>https://am2.co/2020/10/microsoft-azure-hack-for-social-justice/</guid><description>&lt;p&gt;Microsoft is going to be running a virtual hackathon, running from October 12 through November 20. The theme of the hack will be to use Microsoft Azure to address some social justice issue. I&amp;rsquo;m thrilled to be joining &lt;a href="https://socialjusticehack.devpost.com/#judges" rel="noopener noreferrer" target="_blank"&gt;the judging panel&lt;/a&gt; for this event, which is at the intersection of two of my greatest passions&amp;ndash;social justice and technology.&lt;/p&gt;</description></item><item><title>Can we enable tls 1.0 on MSSQL Server 2019 on database level? if yes then how?</title><link>https://am2.co/2020/09/can-we-enable-tls-1-0-on-mssql-server-2019-on-database-level-if-yes-then-how/</link><pubDate>Fri, 25 Sep 2020 20:40:09 -0400</pubDate><guid>https://am2.co/2020/09/can-we-enable-tls-1-0-on-mssql-server-2019-on-database-level-if-yes-then-how/</guid><description>&lt;p&gt;&lt;a href="https://dba.stackexchange.com/q/276113/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 running sql server 2019 on Linux box and trying to connect using a Windows server 2016 client, how can we enable TLS 1.0 for SQL Server 2019 on the Database/instance level.&lt;/p&gt;&#10;&lt;p&gt;TIA.&lt;/p&gt;&#10;&lt;p class="qa-attribution qa-attribution-asked"&gt;&lt;span class="qa-attribution-label"&gt;Asked&lt;/span&gt;&lt;span class="qa-attribution-date"&gt;&lt;a href="https://dba.stackexchange.com/q/276113/52344" rel="noopener" target="_blank"&gt;2020-09-25&lt;/a&gt;&lt;/span&gt;&lt;span class="qa-attribution-by"&gt;by&lt;/span&gt;&lt;span class="qa-attribution-user"&gt;Rafay Pervaiz&lt;/span&gt;&lt;/p&gt;&#10;&lt;hr&gt;&#10;&lt;h2 id="answer"&gt;Answer&lt;/h2&gt;&#10;&lt;h2 id="tldr"&gt;TLDR&lt;/h2&gt;&#10;&lt;p&gt;You don't.&lt;/p&gt;</description></item><item><title>SQL Server 2019 Database stuck In Recovery state after restart</title><link>https://am2.co/2020/09/sql-server-2019-database-stuck-in-recovery-state-after-restart/</link><pubDate>Wed, 23 Sep 2020 07:44:23 -0400</pubDate><guid>https://am2.co/2020/09/sql-server-2019-database-stuck-in-recovery-state-after-restart/</guid><description>&lt;p&gt;&lt;a href="https://dba.stackexchange.com/q/275934/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;SQL Server was restarted by mistake, when it came online, database came back in &amp;quot;In Recovery&amp;quot; mode.&lt;/p&gt;&#10;&lt;p&gt;Check from error it says &amp;quot;Recovery of database 'DB1' (5) is 8% complete (approximately 27146 seconds remain). Phase 2 of 3. This is an informational message only. No user action is required.&lt;/p&gt;</description></item><item><title>How to dig deeper into ASYNC_NETWORK_IO waits</title><link>https://am2.co/2020/08/how-to-dig-deeper-into-async_network_io-waits/</link><pubDate>Sat, 15 Aug 2020 00:48:17 -0400</pubDate><guid>https://am2.co/2020/08/how-to-dig-deeper-into-async_network_io-waits/</guid><description>&lt;p&gt;&lt;a href="https://dba.stackexchange.com/q/273788/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've been handed a graph that comes from SolarWinds showing top wait events broken down by day. The last 2 days there's a part of the daily color coded bar representing a total of 3 hours for ASYNC_NETWORK_IO. Still trying to see if I can get access to Solar Winds panels to try and see if it offers a drill down into the graph or not.&lt;/p&gt;</description></item><item><title>What's important in a code of conduct?</title><link>https://am2.co/2020/06/whats-important-in-a-code-of-conduct/</link><pubDate>Fri, 26 Jun 2020 11:14:10 -0400</pubDate><guid>https://am2.co/2020/06/whats-important-in-a-code-of-conduct/</guid><description>&lt;p&gt;Earlier this week, I published a post about a proposed &lt;a href="https://am2.co/2020/06/24/tech-community-equality-index/" rel="noopener noreferrer" target="_blank"&gt;Tech Community Equality Index&lt;/a&gt;, and used it to grade the largest organization in the data community, &lt;a href="https://web.archive.org/web/20210106205847/https://www.pass.org/" rel="noopener noreferrer" target="_blank"&gt;PASS&lt;/a&gt;.&lt;/p&gt;&#10;&lt;p&gt;One of the areas where I was critical of PASS is that their&lt;a href="https://web.archive.org/web/20170921041142/http://www.pass.org/Portals/0/Policy/Summit-AHP-Dec2016.pdf?ver=2016-12-28-232013-343" rel="noopener noreferrer" target="_blank"&gt; Anti-Harassment Policy&lt;/a&gt; (AHP) is not trans-inclusive, as it does not protect gender identity or expression. The PASS AHP is limited to &amp;ldquo;gender, race, sexual orientation, disability, religion, or any other protected classification,&amp;rdquo; and unfortunately that &lt;em&gt;doesn&amp;rsquo;t include protections for trans folks&lt;/em&gt;. What this text implies is, &amp;ldquo;if the law doesn&amp;rsquo;t protect you, we don&amp;rsquo;t protect you.&amp;rdquo; I don&amp;rsquo;t think that is PASS&amp;rsquo;s intent, but rather a bug in their implementation. In the US, the Supreme Court recently ruled in &lt;a href="https://en.wikipedia.org/wiki/Bostock_v._Clayton_County%2C_Georgia" rel="noopener noreferrer" target="_blank"&gt;Bostock v Clayton County, GA&lt;/a&gt; that &lt;strong&gt;employment&lt;/strong&gt; discrimination based on sexual orientation (including transgender folks) is a protected class under Title VII of the &lt;a href="https://www.history.com/topics/black-history/civil-rights-act" rel="noopener noreferrer" target="_blank"&gt;Civil Rights Act of 1964&lt;/a&gt;, but this only applies to &lt;em&gt;workplace&lt;/em&gt; discrimination &lt;em&gt;in the United States&lt;/em&gt;, and doesn&amp;rsquo;t cover non-work events nor international events. Additionally, the PASS policy makes the AHP optional for SQLSaturday, and provides no guidance or mechanism for local user groups to adopt their AHP.&lt;/p&gt;</description></item><item><title>Tech Community Equality Index</title><link>https://am2.co/2020/06/tech-community-equality-index/</link><pubDate>Wed, 24 Jun 2020 05:00:19 -0400</pubDate><guid>https://am2.co/2020/06/tech-community-equality-index/</guid><description>&lt;style&gt;&#10; table {&#10; border-collapse: collapse;&#10; width: 100%;&#10; caption-side: bottom !important;&#10; }&#10; tr:nth-child(even) {background-color: #F2F7DF;}&#10;&lt;/style&gt;&#10;&lt;p&gt;Over the last weeks &amp;amp; months, I&amp;rsquo;ve had an increasing number of conversations with folks on the topics of diversity, inclusion, equality, and justice. These discussions we have with coworkers, members of the data community, family and friends are all valuable, and help us look at life in a different, more inclusive way.&lt;/p&gt;</description></item><item><title>Hi, I'm Andy. My pronouns are he/him.</title><link>https://am2.co/2020/06/hi-im-andy-my-pronouns-are-he-him/</link><pubDate>Tue, 23 Jun 2020 05:01:47 -0400</pubDate><guid>https://am2.co/2020/06/hi-im-andy-my-pronouns-are-he-him/</guid><description>&lt;p&gt;Lots of folks want to be an ally to the LGBTQ community, but don&amp;rsquo;t know where to start. One great way to be an ally is relatively low-friction.&lt;/p&gt;&#10;&lt;/h2&gt;List your pronouns. Everywhere.&lt;/h2&gt;&#10;&lt;p&gt;Put your pronouns in your social media profile &amp;amp; your email signature. &lt;a href="https://www.linkedin.com/in/edit/intro/" rel="noopener" target="_blank"&gt;Edit your LinkedIn profile&lt;/a&gt;. Put it on your business cards. Make your pronouns &lt;a href="https://www.mypronouns.org/sharing" rel="noopener noreferrer" target="_blank"&gt;part of your introduction&lt;/a&gt;. &amp;ldquo;Hi, I&amp;rsquo;m Andy. My pronouns are he/him. Nice to meet you.&amp;rdquo;&lt;/p&gt;</description></item><item><title>Remove/suppress dashes from "Results to Text" output in SSMS?</title><link>https://am2.co/2020/06/remove-suppress-dashes-from-results-to-text-output-in-ssms/</link><pubDate>Mon, 15 Jun 2020 06:58:39 -0400</pubDate><guid>https://am2.co/2020/06/remove-suppress-dashes-from-results-to-text-output-in-ssms/</guid><description>&lt;p&gt;&lt;a href="https://dba.stackexchange.com/q/269165/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;(This is just a "reproducer", not the real code, because that's long and complicated.)&lt;/p&gt;&#10;&lt;p&gt;The output of&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;SET&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;NOCOUNT&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="k"&gt;ON&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="k"&gt;select&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;@@&lt;/span&gt;&lt;span class="n"&gt;SERVICENAME&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="k"&gt;select&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;@@&lt;/span&gt;&lt;span class="k"&gt;version&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;is:&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;-----------------------------------------------------------------------------&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;MSSQLSERVER&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;-----------------------------------------------------------------------------&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Microsoft SQL Server 2014 (SP3-CU4) (KB4500181) - 12.0.6329.1 (X64) &#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; Jul 20 2019 21:42:29 &#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; Copyright (c) Microsoft Corporation&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; Enterprise Edition: Core-based Licensing (64-bit) on Windows NT 6.3 &amp;lt;X64&amp;gt; (Build 9600: ) (Hypervisor)&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;How can I get output which looks like this:&lt;/p&gt;</description></item><item><title>Racism is our problem to solve</title><link>https://am2.co/2020/06/racism-is-our-problem-to-solve/</link><pubDate>Tue, 09 Jun 2020 01:00:59 -0400</pubDate><guid>https://am2.co/2020/06/racism-is-our-problem-to-solve/</guid><description>&lt;style&gt;&#10; table {&#10; border-collapse: collapse;&#10; width: 100%;&#10; caption-side: bottom !important;&#10; }&#10; tr:nth-child(even) {background-color: #F2F7DF;}&#10;&lt;/style&gt;&#10;&lt;blockquote&gt;This month's T-SQL Tuesday is hosted by Kenneth Fisher (&lt;a href="https://sqlstudies.com" rel="noopener noreferrer" target="_blank"&gt;blog&lt;/a&gt;). &lt;a href="https://sqlstudies.com/2020/06/02/tsql-tuesday-127-invite-non-sql-tips-and-tricks/" rel="noopener noreferrer" target="_blank"&gt;Kenneth asked&lt;/a&gt; us to talk about any non-SQL tips and tricks we have. I'm going to take the moment to give some tips on how (and why) you can help fight bigotry, racism, and racial injustice. &lt;/blockquote&gt;&#10;&lt;h2 id="in-the-us-racism-is-a-white-people-problem"&gt;In the US, Racism is a white people problem&lt;/h2&gt;&#10;&lt;p&gt;The lack of diversity in Tech is a &lt;a href="#diversity-data"&gt;well-documented, well-known problem&lt;/a&gt;. Most companies have employee resource groups (ERGs) or other programs to help tackle the problem and build a more diverse workforce. However, companies cannot solve this problem without the engagement and help of employees.&lt;/p&gt;</description></item><item><title>Pride is a riot</title><link>https://am2.co/2020/06/pride-is-a-riot/</link><pubDate>Mon, 08 Jun 2020 08:30:10 -0400</pubDate><guid>https://am2.co/2020/06/pride-is-a-riot/</guid><description>&lt;p&gt;Last year was the 50th anniversary of the &lt;a href="https://www.history.com/topics/gay-rights/the-stonewall-riots" rel="noopener noreferrer" target="_blank"&gt;Stonewall riots&lt;/a&gt;, which mark the start of the modern LGBTQ rights movement in the US. In the subsequent half century, the queer community has made significant strides in our march towards equality. Sodomy laws were struck down by the courts (but &lt;a href="https://en.wikipedia.org/wiki/Lawrence_v._Texas" rel="noopener noreferrer" target="_blank"&gt;only as recently as 2003&lt;/a&gt;), same-sex couples can be married (state-by-state, starting &lt;a href="https://en.wikipedia.org/wiki/Same-sex_marriage_in_Massachusetts" rel="noopener noreferrer" target="_blank"&gt;in Massachusetts in 2004&lt;/a&gt;, and &lt;a href="https://en.wikipedia.org/wiki/Obergefell_v._Hodges" rel="noopener noreferrer" target="_blank"&gt;only with Federal recognition in 2015&lt;/a&gt;), and 21 states have enacted employment laws to fully protect employees from discrimination based on gender identity or sexual orientation. (As of today, &lt;a href="https://en.wikipedia.org/wiki/LGBT_employment_discrimination_in_the_United_States#State_law" rel="noopener noreferrer" target="_blank"&gt;29 states still don&amp;rsquo;t protect LGBTQ folks in the workplace&lt;/a&gt;: 12 states provide no protection, and 17 states provide only partial protection).&lt;/p&gt;</description></item><item><title>Why the instance name of SQL Server Express is changing?</title><link>https://am2.co/2020/05/why-the-instance-name-of-sql-server-express-is-changing/</link><pubDate>Thu, 21 May 2020 08:12:15 -0400</pubDate><guid>https://am2.co/2020/05/why-the-instance-name-of-sql-server-express-is-changing/</guid><description>&lt;p&gt;&lt;a href="https://dba.stackexchange.com/q/267593/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 working on a web app which is using &lt;/p&gt;&#10;&lt;pre class="infoMsg"&gt;&lt;code&gt;SQL Server Express (Microsoft SQL Server 2016 (SP1) (KB3182545) -&#10; 13.0.4001.0 (X64) Oct 28 2016 18:17:30 Copyright (c) Microsoft Corporation Express Edition (64-bit) on Windows 10 Pro 6.3 &#10; (Build 18362: )).&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;The web app is using connection string to connect to DB. After searching for a few days for a proper connection string format I managed to find the format, using method described by Nik in &lt;a target="_blank" rel="noopener"&gt;this blog&lt;/a&gt; post and it is:&lt;/p&gt;</description></item><item><title>Recursive CTE in SQL Server to count blocking sessions</title><link>https://am2.co/2020/05/recursive-cte-in-sql-server-to-count-blocking-sessions/</link><pubDate>Mon, 18 May 2020 19:54:25 -0400</pubDate><guid>https://am2.co/2020/05/recursive-cte-in-sql-server-to-count-blocking-sessions/</guid><description>&lt;p&gt;&lt;a href="https://stackoverflow.com/q/72295228/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&amp;rsquo;m trying to make CTE to count blocking sessions on server. Currently I made a function to do so(returns blocking session amount). But still could not write this query with CTE.&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="k"&gt;CREATE&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="k"&gt;FUNCTION&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;dbo&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;SESSIONS&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;@&lt;/span&gt;&lt;span class="k"&gt;SESSION&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nb"&gt;int&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="k"&gt;RETURNS&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nb"&gt;INT&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="k"&gt;AS&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="k"&gt;BEGIN&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="k"&gt;DECLARE&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;@&lt;/span&gt;&lt;span class="n"&gt;returnValue&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nb"&gt;int&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;0&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="k"&gt;SET&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;@&lt;/span&gt;&lt;span class="n"&gt;returnValue&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="o"&gt;@&lt;/span&gt;&lt;span class="n"&gt;returnValue&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="p"&gt;(&lt;/span&gt;&lt;span class="w"&gt;&#9;&#9;&#9;&#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; &#9;&#9;&#9;&lt;/span&gt;&lt;span class="k"&gt;SELECT&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="k"&gt;isNULL&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; &#9;&#9;&#9;&lt;/span&gt;&lt;span class="k"&gt;SELECT&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;SELECT&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="k"&gt;COUNT&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;session_id&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="k"&gt;FROM&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;sys&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;dm_exec_requests&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;R2&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="k"&gt;WHERE&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;blocking_session_id&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;R1&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;blocking_session_id&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="k"&gt;AS&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;BLOCKING&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; &#9;&#9;&#9;&lt;/span&gt;&lt;span class="k"&gt;FROM&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;sys&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;dm_exec_requests&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;r1&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="k"&gt;WHERE&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;blocking_session_id&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;R3&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;session_id&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; &#9;&#9;&#9;&lt;/span&gt;&lt;span class="k"&gt;GROUP&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="k"&gt;BY&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;blocking_session_id&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;0&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; &#9;&#9;&#9;&lt;/span&gt;&lt;span class="k"&gt;FROM&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;sys&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;dm_exec_sessions&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;R3&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="k"&gt;where&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;session_id&lt;/span&gt;&lt;span class="o"&gt;=@&lt;/span&gt;&lt;span class="k"&gt;SESSION&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; &#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; &#9;&lt;/span&gt;&lt;span class="k"&gt;DECLARE&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;@&lt;/span&gt;&lt;span class="n"&gt;s&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nb"&gt;int&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="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;SELECT&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="k"&gt;MAX&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;session_id&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="k"&gt;FROM&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;sys&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;dm_exec_requests&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; &#9;&#9;&#9; &lt;/span&gt;&lt;span class="k"&gt;WHERE&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;blocking_session_id&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="o"&gt;@&lt;/span&gt;&lt;span class="k"&gt;SESSION&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;&#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; &#9;&lt;/span&gt;&lt;span class="k"&gt;IF&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;@&lt;/span&gt;&lt;span class="n"&gt;s&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="k"&gt;IS&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="k"&gt;NOT&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="k"&gt;NULL&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; &#9;&lt;/span&gt;&lt;span class="k"&gt;BEGIN&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; &#9;&#9;&lt;/span&gt;&lt;span class="k"&gt;SET&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;@&lt;/span&gt;&lt;span class="n"&gt;returnValue&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="o"&gt;@&lt;/span&gt;&lt;span class="n"&gt;returnValue&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;dbo&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;SESSIONS&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;@&lt;/span&gt;&lt;span class="n"&gt;s&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; &#9;&lt;/span&gt;&lt;span class="k"&gt;END&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; &#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; &#9;&lt;/span&gt;&lt;span class="k"&gt;RETURN&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;@&lt;/span&gt;&lt;span class="n"&gt;returnValue&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="k"&gt;END&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p class="qa-attribution qa-attribution-asked"&gt;&lt;span class="qa-attribution-label"&gt;Asked&lt;/span&gt;&lt;span class="qa-attribution-date"&gt;&lt;a href="https://stackoverflow.com/q/72295228/1948808" rel="noopener" target="_blank"&gt;2022-05-18&lt;/a&gt;&lt;/span&gt;&lt;span class="qa-attribution-by"&gt;by&lt;/span&gt;&lt;span class="qa-attribution-user"&gt;&lt;a href="https://stackoverflow.com/users/4715808" rel="noopener" target="_blank"&gt;mortu&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;</description></item><item><title>Find the SQL Server service account with sys.dm_server_services</title><link>https://am2.co/2020/05/find-the-sql-server-service-account-with-sys-dm_server_services/</link><pubDate>Tue, 12 May 2020 09:00:56 -0400</pubDate><guid>https://am2.co/2020/05/find-the-sql-server-service-account-with-sys-dm_server_services/</guid><description>&lt;p&gt;SQL Server 2005 introduced &lt;a href="https://docs.microsoft.com/en-us/sql/relational-databases/system-dynamic-management-views/system-dynamic-management-views" rel="noopener noreferrer" target="_blank"&gt;Dynamic Management Views(DMVs)&lt;/a&gt;. Technically, there are both views &amp;amp; functions&amp;ndash;DMVs &amp;amp; DMFs, but colloquially they&amp;rsquo;re often simply referred to as just &amp;ldquo;DMVs&amp;rdquo;. DMVs simply return information about the state of the server or database and can be used for monitoring and troubleshooting of server/database health &amp;amp; performance.&lt;/p&gt;</description></item><item><title>Making non-SARGable queries seek, without changing the query</title><link>https://am2.co/2020/05/making-non-sargable-queries-seek-without-changing-the-query/</link><pubDate>Wed, 06 May 2020 08:36:27 -0400</pubDate><guid>https://am2.co/2020/05/making-non-sargable-queries-seek-without-changing-the-query/</guid><description>&lt;p&gt;We&amp;rsquo;ve all been there. You&amp;rsquo;ve got a query where the &lt;code&gt;JOIN&lt;/code&gt; or &lt;code&gt;WHERE&lt;/code&gt; predicate is not &lt;a href="https://dba.stackexchange.com/a/217983/52344" rel="noopener noreferrer" target="_blank"&gt;SARGable&lt;/a&gt;. You&amp;rsquo;ve read about how &lt;a href="https://www.erikdarlingdata.com/2019/04/slightly-less-not-sargable/" rel="noopener noreferrer" target="_blank"&gt;this can be a problem&lt;/a&gt;, and &lt;a href="https://www.erikdarlingdata.com/2019/04/slightly-less-not-sargable/" rel="noopener noreferrer" target="_blank"&gt;how bad it is for performance&lt;/a&gt;.&lt;/p&gt;&#10;&lt;p&gt;Alas, you cannot change the query. Sometimes this reason is political, sometimes it&amp;rsquo;s because you&amp;rsquo;ve got a third-party app and simply don&amp;rsquo;t have access to the code. But you do have access to the database&amp;hellip;&lt;/p&gt;</description></item><item><title>Replication latency when an Availability Group replica is offline</title><link>https://am2.co/2020/05/replication-latency-when-an-availability-group-replica-is-offline/</link><pubDate>Mon, 04 May 2020 10:02:52 -0400</pubDate><guid>https://am2.co/2020/05/replication-latency-when-an-availability-group-replica-is-offline/</guid><description>&lt;p&gt;Assume you have configured a transactional replication publisher, which is part of an availability group (AG). Now, you have an asynchronous secondary AG (or mirroring) replica that is offline. Perhaps this is a DR node, and you are doing patching or other planned maintenance on that DR node, with it intentionally offline.&lt;/p&gt;</description></item><item><title>Thirsty Thursday - A five-bottle bar for eleven cocktails (and non-alcoholic alternatives)</title><link>https://am2.co/2020/04/five-essential-ingredients/</link><pubDate>Thu, 30 Apr 2020 16:52:41 -0400</pubDate><guid>https://am2.co/2020/04/five-essential-ingredients/</guid><description>&lt;p&gt;In my last Thirsty Thursday post, I published my list of &lt;a href="https://am2.co/2020/04/16/thirsty-thursday-essential-bar-equipment/" rel="noopener noreferrer" target="_blank"&gt;essential bar equipment&lt;/a&gt; for folks who are interested in making mixology their quarantine hobby. Hopefully these little detours from technology &amp;amp; career advice will help with your work-life harmony while we&amp;rsquo;re all working from home.&lt;/p&gt;</description></item><item><title>Stop trying to shrink tempdb files</title><link>https://am2.co/2020/04/stop-trying-to-shrink-tempdb/</link><pubDate>Tue, 28 Apr 2020 09:00:24 -0400</pubDate><guid>https://am2.co/2020/04/stop-trying-to-shrink-tempdb/</guid><description>&lt;h2 id="stop-shrinking-your-tempdb-data-files"&gt;Stop shrinking your tempdb data files&lt;/h2&gt;&#10;&lt;p&gt;I recently wrote about &lt;a href="https://am2.co/2020/04/21/fixing-tempdb/"&gt;growing, shrinking, and removing tempdb files&lt;/a&gt;. In that article I explained that SQL Server won&amp;rsquo;t move a page that contains an internal worktable object, and thus trying to shrink tempdb files can be futile. Today, I&amp;rsquo;m going to explain how attempting to shrink tempdb files can actually be harmful.&lt;/p&gt;</description></item><item><title>Fixing tempdb: Growing, shrinking, and removing data files</title><link>https://am2.co/2020/04/fixing-tempdb/</link><pubDate>Tue, 21 Apr 2020 09:00:37 -0400</pubDate><guid>https://am2.co/2020/04/fixing-tempdb/</guid><description>&lt;p&gt;I recently came across a server where &lt;code&gt;tempdb&lt;/code&gt; was breaking all the rules.&lt;/p&gt;&#10;&lt;ul&gt;&#10;&lt;li&gt;Data files were all different sizes. I want all data files to be the same size so that proportional fill uses them evenly.&lt;/li&gt;&#10;&lt;li&gt;There were 10 &lt;code&gt;tempdb&lt;/code&gt; files, with 8 files on a dedicated disk, and 2 on a slower disk shared with other data files. And free space was sky high, so the extra files aren't needed anymore! (They were probably added to fix a short-term emergency, and never cleaned up.)&lt;/li&gt;&#10;&lt;li&gt;The log file was tiny, and didn't have room to grow. For a 500GB tempdb, the log file was only 4GB!&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;h2 id="three-fixes"&gt;Three fixes&lt;/h2&gt;&#10;&lt;p&gt;There are three problems I&amp;rsquo;ve got to fix. I need to (1) remove those two extra files, (2) grow the &lt;code&gt;tempdb&lt;/code&gt; log file, and (3) even out the size of the data files (and shrink them a little to make room for the larger log file. We&amp;rsquo;re going to tackle these in the reverse order than I listed them&amp;ndash;partially out of necessity, and partially because it&amp;rsquo;s going to be easier.&lt;/p&gt;</description></item><item><title>Thirsty Thursday - Essential bar equipment</title><link>https://am2.co/2020/04/thirsty-thursday-essential-bar-equipment/</link><pubDate>Thu, 16 Apr 2020 09:37:19 -0400</pubDate><guid>https://am2.co/2020/04/thirsty-thursday-essential-bar-equipment/</guid><description>&lt;p&gt;I&amp;rsquo;m writing this post during &lt;a href="http://cdc.gov/coronavirus/2019-ncov/cases-updates/index.html" rel="noopener noreferrer" target="_blank"&gt;the Coronavirus pandemic&lt;/a&gt;. Billions of people across the globe are isolating in their homes. Folks have started exploring new hobbies and interests as a way to pass the time and to keep their mind sharp. Folks are depending heavily on virtual meetings, not just for work, but to stay in touch with friends. I&amp;rsquo;ve started having &amp;ldquo;virtual happy hour&amp;rdquo; with friends, where we share a drink and chat over video call. Cocktails &amp;amp; mixology are a bit of a hobby for me, so I thought I would share some of my hobby with you&amp;ndash;even if it is a bit off-topic for a tech blog.&lt;/p&gt;</description></item><item><title>Should I install SSMS on a server running SQL Server?</title><link>https://am2.co/2020/04/should-i-install-ssms-on-a-server-running-sql-server/</link><pubDate>Tue, 14 Apr 2020 09:00:27 -0400</pubDate><guid>https://am2.co/2020/04/should-i-install-ssms-on-a-server-running-sql-server/</guid><description>&lt;p&gt;There&amp;rsquo;s a lot of advice out there on the internet that suggests that you should not install SSMS on your database servers running SQL Server.&lt;/p&gt;&#10;&lt;p&gt;This came up at work recently, where I was asked &amp;ldquo;Should we install SSMS on our database servers?&amp;rdquo; and my answer is:&lt;/p&gt;</description></item><item><title>Redgate Streamed</title><link>https://am2.co/2020/04/redgate-streamed/</link><pubDate>Thu, 09 Apr 2020 14:22:05 -0400</pubDate><guid>https://am2.co/2020/04/redgate-streamed/</guid><description>&lt;p&gt;Last week, I had the pleasure of participating in &lt;a href="https://redgate.com/hub/events/redgate-events/redgate-streamed/redgate-streamed-2020-04" rel="noopener noreferrer" target="_blank"&gt;Redgate Streamed, a three-day virtual conference&lt;/a&gt; organized by my friends at &lt;a href="https://redgate.com/" rel="noopener noreferrer" target="_blank"&gt;Redgate&lt;/a&gt;. My session was &lt;a href="https://github.com/amtwo/Presentations/tree/production/Shortcuts%20From%20an%20Impatient%20DBA" rel="noopener noreferrer" target="_blank"&gt;Shortcuts from an impatient DBA&lt;/a&gt;&amp;ndash;discussing a bunch of Management Studio tips &amp;amp; tricks for data professionals. The virtual conference was free for all, and was recorded and freely available to watch on demand. The recording of my session is available as part of the &lt;a href="https://event.on24.com/wcc/r/2229339/EB82730779B8D2D15F8E5FFFEC612D8E?Partnerref=LP" rel="noopener noreferrer" target="_blank"&gt;Day 2 recording&lt;/a&gt;, and you can also see some equally great sessions from &lt;a href="https://event.on24.com/wcc/r/2229058/92BEA479CA23F2A1A32AA59D609C9234?partnerref=LP" rel="noopener noreferrer" target="_blank"&gt;Day 1&lt;/a&gt; and &lt;a href="https://event.on24.com/wcc/r/2229398/0808169ACCB9BDC9D5ADD03B6FC572CB?partnerref=LP" rel="noopener noreferrer" target="_blank"&gt;Day 3&lt;/a&gt;.&lt;/p&gt;</description></item><item><title>Can changing database owner affect permissions or role memberships?</title><link>https://am2.co/2020/03/can-changing-database-owner-affect-permissions-or-role-memberships/</link><pubDate>Mon, 30 Mar 2020 21:23:49 -0400</pubDate><guid>https://am2.co/2020/03/can-changing-database-owner-affect-permissions-or-role-memberships/</guid><description>&lt;p&gt;&lt;a href="https://dba.stackexchange.com/q/263956/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;A couple years ago we ran into a situation where we were changing the database owner from a DBA's login to sa, and immediately thereafter we received a complaint that the service login (which was NOT the DBA's login) no longer had access to the database. On checking, the service login had indeed lost it's role memberships. &lt;/p&gt;</description></item><item><title>When STRING_SPLIT() falls short</title><link>https://am2.co/2020/03/when-string_split-falls-short/</link><pubDate>Fri, 20 Mar 2020 10:00:54 -0400</pubDate><guid>https://am2.co/2020/03/when-string_split-falls-short/</guid><description>&lt;p&gt;This morning, my friend Aaron Bertrand (&lt;a href="http://sqlblog.org" rel="noopener noreferrer" target="_blank"&gt;blog&lt;/a&gt;) posted &lt;a href="https://sqlperformance.com/2020/03/t-sql-queries/please-help-string-split-improvements" rel="noopener noreferrer" target="_blank"&gt;a plea for help with &lt;code&gt;STRING_SPLIT()&lt;/code&gt; improvements&lt;/a&gt;. I&amp;rsquo;m very much in Aaron&amp;rsquo;s corner on this, having &lt;a href="https://am2.co/2015/04/21/converting-delimited-values-to-a-table-efficiently/" rel="noopener noreferrer" target="_blank"&gt;written about the olden days myself&lt;/a&gt;.&lt;/p&gt;&#10;&lt;h2&gt;Why &lt;code&gt;STRING_SPLIT()&lt;/code&gt; is supposed to be awesome&lt;/h2&gt;&#10;CLR was fast, but inaccessible to many DBAs. XML was almost as good, but ugh, XML. And multi-statement table valued functions are evil but prevalent. &#10;&lt;p&gt;&lt;code&gt;STRING_SPLIT()&lt;/code&gt; promised to be both super fast, and lift the code maintenance problem for DBAs who don&amp;rsquo;t know .NET and struggle with the crazy XML syntax.&lt;/p&gt;</description></item><item><title>Joining the Friends of Redgate program 🎉</title><link>https://am2.co/2020/03/friends-of-redgate/</link><pubDate>Wed, 04 Mar 2020 10:03:42 -0500</pubDate><guid>https://am2.co/2020/03/friends-of-redgate/</guid><description>&lt;p&gt;I&amp;rsquo;m super excited to announce that today I was notified that I will be joining the &lt;a href="https://www.red-gate.com/hub/events/friends-of-rg" rel="noopener noreferrer" target="_blank"&gt;Friends of Redgate&lt;/a&gt; program! 🎉💃🎊&lt;/p&gt;&#10;&lt;h2 id="whats-the-friends-of-redgate-you-ask"&gt;&amp;ldquo;What&amp;rsquo;s the Friends of Redgate?&amp;rdquo; you ask?&lt;/h2&gt;&#10;&lt;p&gt;Well, the Friends of Redgate is a program for SQL Server Community members who blog/speak/etc within the community. Redgate helps their Friends by providing collaboration opportunities for community activities, and also some VIP insider access to development teams. As a former Product Manager, I know how important it is to allow development teams direct connection to users of the product, to help provide context and feedback to the way the software gets used in the real world&amp;ndash;especially since real world use can be different from what the development team or Product Manager &lt;em&gt;intended&lt;/em&gt; the product use to be.&lt;/p&gt;</description></item><item><title>MS SQL Express 2016 on Amazon AWS: I Can Take Database Offline but Can't Bring It Online</title><link>https://am2.co/2020/03/ms-sql-express-2016-on-amazon-aws-i-can-take-database-offline-but-cant-bring-it-online/</link><pubDate>Sun, 01 Mar 2020 10:59:06 -0500</pubDate><guid>https://am2.co/2020/03/ms-sql-express-2016-on-amazon-aws-i-can-take-database-offline-but-cant-bring-it-online/</guid><description>&lt;p&gt;&lt;a href="https://dba.stackexchange.com/q/260928/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 can take databases offline (via GUI) but can't bring them back online. The server details are as follow:&lt;/p&gt;&#10;&lt;p&gt;RDBMS: MS SQL 2016 Express&#10;Host: Amazon AWS/RDS Free Tier&lt;/p&gt;&#10;&lt;p&gt;&lt;strong&gt;Details/History of the Problem&lt;/strong&gt;&#10;A few months ago, I created a db instance on Amazon AWS and at the time of creation, the 'master/admin' account was setup via the AWS/RDS web page. With this 'admin' account, I have created several databases on that instance without any problems.&lt;/p&gt;</description></item><item><title>How to store real-time data to database</title><link>https://am2.co/2020/02/how-to-store-real-time-data-to-database/</link><pubDate>Sun, 23 Feb 2020 18:38:30 -0500</pubDate><guid>https://am2.co/2020/02/how-to-store-real-time-data-to-database/</guid><description>&lt;p&gt;&lt;a href="https://dba.stackexchange.com/q/260351/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;Here is my situation:&lt;/p&gt;&#10;&lt;ul&gt;&#10;&lt;li&gt;I have a WebSocket connection that feeds me data real-time&lt;/li&gt;&#10;&lt;li&gt;I have an async callback function that gets the data and inserts into a queue&lt;/li&gt;&#10;&lt;li&gt;I have another thread that reads from the queue and stores it into the Postgres database, one row at a time (using python's psycopg2 library)&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;p&gt;The problem is the real-time data comes in faster than the time it takes to insert into the database, and in a couple of hours, the server runs out of memory. (Is this because psycopg2 library is slow?)&lt;/p&gt;</description></item><item><title>Is it possible for master, tempdb, model and msdb to have a database_id other than 1,2,3,4 respectively?</title><link>https://am2.co/2020/02/is-it-possible-for-master-tempdb-model-and-msdb-to-have-a-database_id-other-than-1234-respectively/</link><pubDate>Wed, 12 Feb 2020 12:25:11 -0500</pubDate><guid>https://am2.co/2020/02/is-it-possible-for-master-tempdb-model-and-msdb-to-have-a-database_id-other-than-1234-respectively/</guid><description>&lt;p&gt;&lt;a href="https://dba.stackexchange.com/q/259510/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;SQL Server &lt;a target="_blank" rel="noopener"&gt;System Databases&lt;/a&gt;, as far as I know, always have those same IDs and I have seen lots of maintenance scripts on the internet relying on the predicate &lt;code&gt;WHERE database_id &amp;gt; 4&lt;/code&gt; to exclude them from the actions of the script.&lt;/p&gt;</description></item><item><title>Fastest way to shrink LOB data in SQL Server</title><link>https://am2.co/2020/01/fastest-way-to-shrink-lob-data-in-sql-server/</link><pubDate>Thu, 16 Jan 2020 07:00:12 -0500</pubDate><guid>https://am2.co/2020/01/fastest-way-to-shrink-lob-data-in-sql-server/</guid><description>&lt;p&gt;&lt;a href="https://dba.stackexchange.com/q/257512/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 a database of total size of 3886 GB. Out of which 778 GB is free. So total 3108 GB worth of data is present.&lt;/p&gt;&#10;&lt;p&gt;Out of which 2458 GB is "LOB Data" and 400 GB is worth "Regular".&lt;/p&gt;</description></item><item><title>Job waiting on CXCONSUMER</title><link>https://am2.co/2020/01/job-waiting-on-cxconsumer/</link><pubDate>Thu, 09 Jan 2020 12:09:54 -0500</pubDate><guid>https://am2.co/2020/01/job-waiting-on-cxconsumer/</guid><description>&lt;p&gt;&lt;a href="https://dba.stackexchange.com/q/257011/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 got a procedure on SQL Server agent jobs and this job started to hang on transaction for many hours with wait stats CXCONSUMER and never complete. The problem is after we noticed that it was hanging we kill the job and started manually during and the job was working fine and completing. But right now neither starting manually or on sql agent job seems never completing and hanging on waits with CXCONSUMER. &lt;/p&gt;</description></item></channel></rss>