<?xml version="1.0" encoding="utf-8"?><feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en"><generator uri="https://jekyllrb.com/" version="3.10.0">Jekyll</generator><link href="http://bronowski.it/feed.xml" rel="self" type="application/atom+xml" /><link href="http://bronowski.it/" rel="alternate" type="text/html" hreflang="en" /><updated>2025-08-17T23:04:59+01:00</updated><id>http://bronowski.it/feed.xml</id><title type="html">Mikey Bronowski - Blog</title><subtitle>Mikey Bronowski blogs about data</subtitle><author><name>Mikey Bronowski</name></author><entry xml:lang="en"><title type="html">Festive Tech Calendar 2024: Exclusive Functions in Azure SQL Database and Managed Instance</title><link href="http://bronowski.it/festive-tech-calendar-2024-new-t-sql-functions-magda/" rel="alternate" type="text/html" title="Festive Tech Calendar 2024: Exclusive Functions in Azure SQL Database and Managed Instance" /><published>2024-12-13T00:00:00+00:00</published><updated>2024-12-13T00:00:00+00:00</updated><id>http://bronowski.it/festive-tech-calendar-2024-new-t-sql-functions-magda</id><content type="html" xml:base="http://bronowski.it/festive-tech-calendar-2024-new-t-sql-functions-magda/"><![CDATA[<h1 id="about-festive-tech-calendar">About Festive Tech Calendar</h1>

<p>The <a href="https://festivetechcalendar.com/">Festive Tech Calendar 2024</a> is a community initiative by <a href="https://cloudfamily.info">CloudFamily</a>. This is my first contribution and I am quite excited to be part of it. A big thank you to Gregor (<a href="https://gregorsuttie.com">blog</a>|<a href="https://x.com/gregor_suttie">X</a>) and Richard (<a href="https://pixelrobots.co.uk">blog</a>|<a href="https://x.com/Pixel_Robots">X</a>) for organizing the wonderful event.</p>

<h1 id="azure-sql-offering-vs-classic-sql-server">Azure SQL Offering vs Classic SQL Server</h1>

<p>Microsoft releases the classic SQL Server every couple of years, with some functionality added through regular updates. On the other hand, the SQL Server offering in Azure (Azure SQL Database and Managed Instance) receives the latest features earlier.</p>

<p>This post highlights some of the T-SQL functions currently available in Azure SQL but not yet in classic SQL Server. However, with the <a href="https://www.microsoft.com/en-us/sql-server/blog/2024/11/19/announcing-microsoft-sql-server-2025-apply-for-the-preview-for-the-enterprise-ai-ready-database/">recent announcement of SQL Server 2025</a>, this might change next year. Keep in mind that some of these functions are in preview, so their behavior might evolve as they reach general availability.</p>

<h1 id="unistr-and--string-concatenation"><code class="language-plaintext highlighter-rouge">UNISTR()</code> and <code class="language-plaintext highlighter-rouge">||</code> (String concatenation)</h1>

<p>Microsoft <a href="https://techcommunity.microsoft.com/blog/azuresqlblog/announcing-unistr-and--operator-in-azure-sql-database-%E2%80%93-preview/4157714">announced a public preview of these earlier this year</a>, which are available in Azure SQL Database and <a href="https://learn.microsoft.com/en-us/fabric/database/sql/feature-comparison-sql-database-fabric">SQL database in Microsoft Fabric</a>.</p>

<h2 id="unistr"><code class="language-plaintext highlighter-rouge">UNISTR()</code></h2>

<div class="language-sql highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="c1">-- SYNTAX</span>
<span class="n">UNISTR</span> <span class="p">(</span> <span class="s1">'character_expression'</span> <span class="p">[</span> <span class="p">,</span> <span class="s1">'unicode_escape_character'</span> <span class="p">]</span> <span class="p">)</span>
</code></pre></div></div>

<p>The <a href="https://learn.microsoft.com/en-us/sql/t-sql/functions/unistr-transact-sql"><code class="language-plaintext highlighter-rouge">UNISTR</code> function</a> simplifies working with Unicode code points, making it easy to represent multilingual strings, emojis, and other special characters in SQL queries. The <code class="language-plaintext highlighter-rouge">UNISTR</code> function works only with UTF8-compatible collations.</p>

<p>For example, we can fetch our favorite festive symbols by referencing Unicode code points in a compact and readable format using escape sequences:</p>

<div class="language-sql highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="k">SELECT</span> 
    <span class="n">UNISTR</span><span class="p">(</span><span class="s1">'</span><span class="se">\+</span><span class="s1">0026C4'</span><span class="p">)</span> <span class="k">AS</span> <span class="n">Snowman</span><span class="p">,</span> 
    <span class="n">UNISTR</span><span class="p">(</span><span class="s1">'</span><span class="se">\+</span><span class="s1">002744'</span><span class="p">)</span> <span class="k">AS</span> <span class="n">Snowflake</span><span class="p">,</span> 
    <span class="n">UNISTR</span><span class="p">(</span><span class="s1">'</span><span class="se">\+</span><span class="s1">01F384'</span><span class="p">)</span> <span class="k">AS</span> <span class="n">ChristmasTree</span><span class="p">,</span> 
    <span class="n">UNISTR</span><span class="p">(</span><span class="s1">'</span><span class="se">\+</span><span class="s1">01F381'</span><span class="p">)</span> <span class="k">AS</span> <span class="n">Present</span><span class="p">,</span> 
    <span class="n">UNISTR</span><span class="p">(</span><span class="s1">'</span><span class="se">\+</span><span class="s1">01F525'</span><span class="p">)</span> <span class="k">AS</span> <span class="n">Fire</span><span class="p">,</span>
    <span class="n">UNISTR</span><span class="p">(</span><span class="s1">'</span><span class="se">\+</span><span class="s1">01F385'</span><span class="p">)</span> <span class="k">AS</span> <span class="n">Santa</span><span class="p">;</span>


<span class="c1">-- Output: ⛄❄🎄🎁🔥🎅</span>

</code></pre></div></div>

<h3 id="comparing-with-nchar">Comparing with <code class="language-plaintext highlighter-rouge">NCHAR</code></h3>
<p>To achieve the same result using <code class="language-plaintext highlighter-rouge">NCHAR()</code>, you need to account for surrogate pairs for characters above the <a href="https://www.unicode.org/roadmaps/bmp/">Basic Multilingual Plane (BMP)</a>, making it less compact.</p>

<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>SELECT 
    NCHAR(0xD83C) + NCHAR(0xDF84) AS ChristmasTree, -- 🎄
    NCHAR(0xD83C) + NCHAR(0xDF81) AS Present,       -- 🎁
    NCHAR(0xD83D) + NCHAR(0xDD25) AS Fire,          -- 🔥
    NCHAR(0xD83C) + NCHAR(0xDF85) AS Santa;         -- 🎅
</code></pre></div></div>

<h3 id="working-with-escape-characters">Working with Escape Characters</h3>
<p>The default escape character (<code class="language-plaintext highlighter-rouge">\</code>) simplifies paths and mixed sequences:</p>

<div class="language-sql highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="c1">-- default escape character is '\'</span>
<span class="k">SELECT</span> <span class="n">UNISTR</span><span class="p">(</span><span class="s1">'C:</span><span class="se">\\</span><span class="s1">Path</span><span class="se">\\</span><span class="s1">To</span><span class="se">\\</span><span class="s1">File</span><span class="se">\+</span><span class="s1">0041'</span><span class="p">)</span> <span class="k">AS</span> <span class="n">FilePath</span><span class="p">;</span>
<span class="c1">-- Output: C:\Path\To\FileA</span>


<span class="c1">-- custom escape character</span>
<span class="k">SELECT</span> <span class="n">UNISTR</span><span class="p">(</span><span class="n">N</span><span class="s1">'#0041#0042#0043'</span><span class="p">,</span> <span class="s1">'#'</span><span class="p">)</span> <span class="k">AS</span> <span class="n">ABC</span><span class="p">;</span>
<span class="c1">-- Output: ABC</span>
</code></pre></div></div>

<p>If you work with Unicode frequently, here’s a helpful list of <a href="https://codepoints.net/">codepoints</a>.</p>

<h2 id="-string-concatenation"><code class="language-plaintext highlighter-rouge">||</code> (String concatenation)</h2>
<p>The <a href="https://learn.microsoft.com/en-us/sql/t-sql/language-elements/string-concatenation-pipes-transact-sql"><code class="language-plaintext highlighter-rouge">|| operator</code></a> is used to concatenate strings in T-SQL. It behaves similarly to the <code class="language-plaintext highlighter-rouge">+</code> operator but aligns T-SQL with SQL dialects like PostgreSQL, Oracle, and MySQL, where <code class="language-plaintext highlighter-rouge">||</code> is the standard.</p>

<div class="language-sql highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="c1">-- concatenation with mixed types (converts to string)</span>
<span class="k">SELECT</span><span class="err"> </span><span class="mi">1</span><span class="p">.</span><span class="mi">0</span><span class="err"> </span><span class="o">||</span><span class="err"> </span><span class="s1">'Calendar'</span><span class="err"> </span><span class="o">||</span><span class="err"> </span><span class="mi">2</span><span class="err"> </span><span class="o">||</span><span class="err"> </span><span class="mi">3</span><span class="p">;</span> 
<span class="c1">-- Output: 1.0Calendar23</span>

<span class="c1">-- at least one operand must be a string</span>
<span class="k">SELECT</span><span class="err"> </span><span class="mi">1</span><span class="err"> </span><span class="o">||</span><span class="err"> </span><span class="mi">1</span>
<span class="c1">-- Error: The data types int and int are incompatible in the concat operator.</span>

<span class="c1">-- incompatible types</span>
<span class="k">select</span><span class="err"> </span><span class="s1">'1'</span><span class="err"> </span><span class="o">||</span><span class="err"> </span><span class="mi">0</span><span class="n">x1</span>
<span class="c1">-- Error: The data types varchar and varbinary are incompatible in the concat operator.</span>

<span class="c1">-- concatenate Christmas trees</span>
<span class="k">select</span> <span class="s1">'🎄'</span><span class="o">||</span> <span class="s1">'🎄'</span><span class="o">||</span> <span class="s1">'🎄'</span><span class="o">||</span> <span class="s1">'🎄'</span><span class="o">||</span> <span class="s1">'🎄'</span><span class="o">||</span> <span class="s1">'🎄'</span><span class="o">||</span> <span class="s1">'🎄'</span><span class="o">||</span><span class="mi">2024</span><span class="o">||</span><span class="s1">'🎄'</span><span class="o">||</span> <span class="s1">'🎄'</span><span class="o">||</span> <span class="s1">'🎄'</span><span class="o">||</span> <span class="s1">'🎄'</span><span class="o">||</span> <span class="s1">'🎄'</span><span class="o">||</span> <span class="s1">'🎄'</span><span class="o">||</span> <span class="s1">'🎄'</span><span class="p">;</span>
<span class="c1">-- Output: 🎄🎄🎄🎄🎄🎄🎄2024🎄🎄🎄🎄🎄🎄🎄</span>
</code></pre></div></div>

<h2 id="-compound-assignment"><code class="language-plaintext highlighter-rouge">||=</code> (Compound assignment)</h2>

<p>The <a href="https://learn.microsoft.com/en-us/sql/t-sql/language-elements/compound-assignment-pipes-transact-sql"><code class="language-plaintext highlighter-rouge">||= operator</code></a> combines concatenation with assignment, making it easy to append values to an existing variable or column. It behaves like the <code class="language-plaintext highlighter-rouge">+=</code> operator for character and binary strings.</p>

<p>Example: A Flat 1D Christmas Tree</p>
<div class="language-sql highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="k">DECLARE</span> <span class="o">@</span><span class="n">ChristmasTree</span> <span class="n">NVARCHAR</span><span class="p">(</span><span class="mi">16</span><span class="p">)</span> <span class="o">=</span> <span class="s1">''</span><span class="p">;</span>

<span class="k">SET</span> <span class="o">@</span><span class="n">ChristmasTree</span> <span class="o">||=</span> <span class="n">UNISTR</span><span class="p">(</span><span class="s1">'</span><span class="se">\+</span><span class="s1">00272F'</span><span class="p">);</span>
<span class="k">SET</span> <span class="o">@</span><span class="n">ChristmasTree</span> <span class="o">||=</span> <span class="n">UNISTR</span><span class="p">(</span><span class="s1">'</span><span class="se">\+</span><span class="s1">01F384'</span><span class="p">);</span>
<span class="k">SET</span> <span class="o">@</span><span class="n">ChristmasTree</span> <span class="o">||=</span> <span class="n">UNISTR</span><span class="p">(</span><span class="s1">'</span><span class="se">\+</span><span class="s1">01F384'</span><span class="p">);</span>
<span class="k">SET</span> <span class="o">@</span><span class="n">ChristmasTree</span> <span class="o">||=</span> <span class="n">UNISTR</span><span class="p">(</span><span class="s1">'</span><span class="se">\+</span><span class="s1">01F384'</span><span class="p">);</span>
<span class="k">SET</span> <span class="o">@</span><span class="n">ChristmasTree</span> <span class="o">||=</span> <span class="n">UNISTR</span><span class="p">(</span><span class="s1">'</span><span class="se">\+</span><span class="s1">01F384'</span><span class="p">);</span>
<span class="k">SET</span> <span class="o">@</span><span class="n">ChristmasTree</span> <span class="o">||=</span> <span class="n">UNISTR</span><span class="p">(</span><span class="s1">'</span><span class="se">\+</span><span class="s1">01F381'</span><span class="p">);</span>

<span class="k">SELECT</span> <span class="o">@</span><span class="n">ChristmasTree</span> <span class="k">AS</span> <span class="p">[</span><span class="mi">1</span><span class="n">DChristmasTree</span><span class="p">];</span>

<span class="cm">/* Output:
1DChristmasTree
✯🎄🎄🎄🎄🎁
*/</span>
</code></pre></div></div>

<h3 id="conclusion">Conclusion</h3>
<p>The <code class="language-plaintext highlighter-rouge">UNISTR</code>, <code class="language-plaintext highlighter-rouge">||</code>, and <code class="language-plaintext highlighter-rouge">||=</code> operators are a nice  additions to T-SQL, streamlining Unicode handling and string concatenation in Azure SQL Database. They align T-SQL with other SQL dialects, making it easier to work with multilingual data, emojis, and dynamic string manipulation.</p>

<h1 id="json_objectagg-and-json_arrayagg">JSON_OBJECTAGG() and JSON_ARRAYAGG()</h1>

<p>The JSON type and aggregate functions were <a href="https://techcommunity.microsoft.com/blog/azuresqlblog/native-json-type--json-aggregates-are-now-in-private-preview-for-azure-sql-datab/3830753">announced last year</a> and are currently in preview for Azure SQL Database and Azure SQL Managed Instance.</p>

<h2 id="json-object-vs-array">JSON object vs array</h2>

<p>Before we jump right in into the new functions, here’s a quick introduction to JSON.</p>

<p><a href="https://www.json.org/json-en.html">JSON (JavaScript Object Notation)</a> uses two fundamental structures: <strong>arrays</strong> and <strong>objects</strong>. While both are used to represent data in JSON, they serve different purposes and have distinct structures.</p>

<h3 id="json-array">JSON Array</h3>
<p>A JSON array is an ordered collection of values (like a list). It can contain elements of any type: strings, numbers, objects, other arrays, or even <code class="language-plaintext highlighter-rouge">null</code>. Elements are indexed by their position, starting from 0.</p>

<h3 id="example-json-array">Example: JSON Array</h3>

<div class="language-json highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="p">[</span><span class="s2">"Apple"</span><span class="p">,</span><span class="w"> </span><span class="s2">"Banana"</span><span class="p">,</span><span class="w"> </span><span class="s2">"Cherry"</span><span class="p">]</span><span class="w">
</span></code></pre></div></div>

<p>Use Case:</p>
<ul>
  <li>Lists of related items (e.g., product names, user IDs).</li>
  <li>Data where order matters (e.g., a sequence of events).</li>
</ul>

<h3 id="json-object">JSON Object</h3>
<p>A JSON object is a collection of key-value pairs (like a dictionary or map). Keys must be strings, while values can be any valid JSON type. Keys are unique, and their order is not guaranteed.</p>

<h3 id="example-json-object">Example: JSON Object</h3>
<div class="language-json highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="p">{</span><span class="w">
  </span><span class="nl">"name"</span><span class="p">:</span><span class="w"> </span><span class="s2">"Santa"</span><span class="p">,</span><span class="w">
  </span><span class="nl">"age"</span><span class="p">:</span><span class="w"> </span><span class="mi">65</span><span class="p">,</span><span class="w">
  </span><span class="nl">"city"</span><span class="p">:</span><span class="w"> </span><span class="s2">"North Pole"</span><span class="w">
</span><span class="p">}</span><span class="w">
</span></code></pre></div></div>

<p>Use Case:</p>
<ul>
  <li>Represent structured data (e.g., a single entity like a person or a product).</li>
  <li>When accessing data by meaningful identifiers (e.g., “name”, “age”).</li>
</ul>

<h2 id="festive-tables-for-examples">Festive Tables for Examples</h2>

<p>Let’s create some sample festive tables and see both functions in action:</p>

<div class="language-sql highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="k">CREATE</span> <span class="k">TABLE</span> <span class="n">Workshop</span> <span class="p">(</span>
    <span class="n">WorkshopID</span> <span class="nb">INT</span> <span class="k">PRIMARY</span> <span class="k">KEY</span><span class="p">,</span>
    <span class="n">WorkshopName</span> <span class="n">NVARCHAR</span><span class="p">(</span><span class="mi">50</span><span class="p">)</span>
<span class="p">);</span>

<span class="k">CREATE</span> <span class="k">TABLE</span> <span class="n">Elves</span> <span class="p">(</span>
    <span class="n">ElfID</span> <span class="nb">INT</span> <span class="k">PRIMARY</span> <span class="k">KEY</span><span class="p">,</span>
    <span class="n">ElfName</span> <span class="n">NVARCHAR</span><span class="p">(</span><span class="mi">50</span><span class="p">),</span>
    <span class="n">JoinDate</span> <span class="nb">DATE</span><span class="p">,</span>
    <span class="n">WorkshopID</span> <span class="nb">INT</span> <span class="k">FOREIGN</span> <span class="k">KEY</span> <span class="k">REFERENCES</span> <span class="n">Workshop</span><span class="p">(</span><span class="n">WorkshopID</span><span class="p">)</span>
<span class="p">);</span>

<span class="k">INSERT</span> <span class="k">INTO</span> <span class="n">Workshop</span> <span class="p">(</span><span class="n">WorkshopID</span><span class="p">,</span> <span class="n">WorkshopName</span><span class="p">)</span>
<span class="k">VALUES</span> 
    <span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="s1">'Toy Assembly'</span><span class="p">),</span>
    <span class="p">(</span><span class="mi">2</span><span class="p">,</span> <span class="s1">'Gift Wrapping'</span><span class="p">),</span>
    <span class="p">(</span><span class="mi">3</span><span class="p">,</span> <span class="s1">'Reindeer Care'</span><span class="p">);</span>


<span class="k">INSERT</span> <span class="k">INTO</span> <span class="n">Elves</span> <span class="p">(</span><span class="n">ElfID</span><span class="p">,</span> <span class="n">ElfName</span><span class="p">,</span> <span class="n">JoinDate</span><span class="p">,</span> <span class="n">WorkshopID</span><span class="p">)</span>
<span class="k">VALUES</span> 
    <span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="s1">'Buddy'</span><span class="p">,</span> <span class="s1">'2021-12-01'</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span>
    <span class="p">(</span><span class="mi">2</span><span class="p">,</span> <span class="s1">'Jingle'</span><span class="p">,</span> <span class="s1">'2020-11-15'</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span>
    <span class="p">(</span><span class="mi">3</span><span class="p">,</span> <span class="s1">'Sparkle'</span><span class="p">,</span> <span class="s1">'2022-01-10'</span><span class="p">,</span> <span class="mi">2</span><span class="p">),</span>
    <span class="p">(</span><span class="mi">4</span><span class="p">,</span> <span class="s1">'Snowflake'</span><span class="p">,</span> <span class="s1">'2023-03-05'</span><span class="p">,</span> <span class="mi">2</span><span class="p">),</span>
    <span class="p">(</span><span class="mi">5</span><span class="p">,</span> <span class="s1">'Peppermint'</span><span class="p">,</span> <span class="s1">'2020-12-20'</span><span class="p">,</span> <span class="mi">3</span><span class="p">);</span>
</code></pre></div></div>

<h2 id="json_arrayagg-function"><code class="language-plaintext highlighter-rouge">JSON_ARRAYAGG()</code> function</h2>

<div class="language-sql highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="c1">-- SYNTAX</span>
<span class="n">JSON_ARRAYAGG</span> <span class="p">(</span><span class="n">value_expression</span> <span class="p">[</span> <span class="n">order_by_clause</span> <span class="p">]</span> <span class="p">[</span> <span class="n">json_null_clause</span> <span class="p">]</span> <span class="p">)</span> 
</code></pre></div></div>

<p>The <a href="https://learn.microsoft.com/en-us/sql/t-sql/functions/json-arrayagg-transact-sql"><code class="language-plaintext highlighter-rouge">JSON_ARRAYAGG</code></a> constructs a JSON array from an aggregation of SQL data or columns.</p>

<h3 id="example-json-array-of-elf-names">Example: JSON Array of Elf Names</h3>

<div class="language-sql highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="k">SELECT</span> <span class="n">JSON_ARRAYAGG</span><span class="p">(</span><span class="n">ElfName</span> <span class="k">ORDER</span> <span class="k">BY</span> <span class="n">JoinDate</span> <span class="k">ASC</span><span class="p">)</span> <span class="k">AS</span> <span class="n">ElfNames</span>
<span class="k">FROM</span> <span class="n">Elves</span><span class="p">;</span>
<span class="c1">-- Output: ["Jingle","Peppermint","Buddy","Sparkle","Snowflake"]</span>


<span class="k">SELECT</span> <span class="n">JSON_ARRAYAGG</span><span class="p">(</span><span class="n">WorkshopName</span> <span class="k">ORDER</span> <span class="k">BY</span> <span class="n">WorkshopName</span> <span class="k">ASC</span><span class="p">)</span> <span class="k">AS</span> <span class="n">Workshop</span>
<span class="k">FROM</span> <span class="n">Workshop</span><span class="p">;</span>
<span class="c1">-- Output: ["Gift Wrapping","Reindeer Care","Toy Assembly"]</span>
</code></pre></div></div>

<h2 id="json_objectagg-function"><code class="language-plaintext highlighter-rouge">JSON_OBJECTAGG()</code> function</h2>

<div class="language-sql highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="c1">-- SYNTAX</span>
<span class="n">JSON_OBJECTAGG</span> <span class="p">(</span> <span class="n">json_key_value</span> <span class="p">[</span> <span class="n">json_null_clause</span> <span class="p">]</span> <span class="p">)</span>
</code></pre></div></div>

<p>The <a href="https://learn.microsoft.com/en-us/sql/t-sql/functions/json-objectagg-transact-sql"><code class="language-plaintext highlighter-rouge">JSON_OBJECTAGG</code></a> function constructs a JSON object from an aggregation of SQL data or columns.</p>

<h3 id="example-json-object-of-elf-directory">Example: JSON Object of Elf Directory</h3>

<div class="language-sql highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="k">SELECT</span> <span class="n">JSON_OBJECTAGG</span><span class="p">(</span><span class="n">ElfID</span><span class="p">:</span> <span class="n">ElfName</span><span class="p">)</span> <span class="k">AS</span> <span class="n">ElfDirectory</span>
<span class="k">FROM</span> <span class="n">Elves</span><span class="p">;</span>
</code></pre></div></div>

<p>Output:</p>
<div class="language-json highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="p">{</span><span class="w">
    </span><span class="nl">"1"</span><span class="p">:</span><span class="w"> </span><span class="s2">"Buddy"</span><span class="p">,</span><span class="w">
    </span><span class="nl">"2"</span><span class="p">:</span><span class="w"> </span><span class="s2">"Jingle"</span><span class="p">,</span><span class="w">
    </span><span class="nl">"3"</span><span class="p">:</span><span class="w"> </span><span class="s2">"Sparkle"</span><span class="p">,</span><span class="w">
    </span><span class="nl">"4"</span><span class="p">:</span><span class="w"> </span><span class="s2">"Snowflake"</span><span class="p">,</span><span class="w">
    </span><span class="nl">"5"</span><span class="p">:</span><span class="w"> </span><span class="s2">"Peppermint"</span><span class="w">
</span><span class="p">}</span><span class="w">
</span></code></pre></div></div>

<h3 id="example-combining-json_arrayagg-and-json_objectagg">Example: Combining JSON_ARRAYAGG() and JSON_OBJECTAGG()</h3>
<p>We can combine both functions to generate a JSON object where each workshop maps to an array of elf names:</p>

<div class="language-sql highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="k">WITH</span> <span class="n">ElfGroups</span> <span class="k">AS</span> <span class="p">(</span>
    <span class="k">SELECT</span> 
        <span class="n">W</span><span class="p">.</span><span class="n">WorkshopName</span><span class="p">,</span>
        <span class="n">JSON_ARRAYAGG</span><span class="p">(</span><span class="n">E</span><span class="p">.</span><span class="n">ElfName</span> <span class="k">ORDER</span> <span class="k">BY</span> <span class="n">E</span><span class="p">.</span><span class="n">ElfName</span> <span class="k">ASC</span><span class="p">)</span> <span class="k">AS</span> <span class="n">ElfArray</span>
    <span class="k">FROM</span> <span class="n">Workshop</span> <span class="n">W</span>
    <span class="k">JOIN</span> <span class="n">Elves</span> <span class="n">E</span> <span class="k">ON</span> <span class="n">W</span><span class="p">.</span><span class="n">WorkshopID</span> <span class="o">=</span> <span class="n">E</span><span class="p">.</span><span class="n">WorkshopID</span>
    <span class="k">GROUP</span> <span class="k">BY</span> <span class="n">W</span><span class="p">.</span><span class="n">WorkshopName</span>
<span class="p">)</span>
<span class="k">SELECT</span> <span class="n">JSON_OBJECTAGG</span><span class="p">(</span><span class="n">WorkshopName</span><span class="p">:</span> <span class="n">ElfArray</span><span class="p">)</span> <span class="k">AS</span> <span class="n">WorkshopElves</span>
<span class="k">FROM</span> <span class="n">ElfGroups</span><span class="p">;</span>
</code></pre></div></div>

<p>Output:</p>
<div class="language-json highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="p">{</span><span class="w">
    </span><span class="nl">"Toy Assembly"</span><span class="p">:</span><span class="w"> </span><span class="p">[</span><span class="s2">"Buddy"</span><span class="p">,</span><span class="w"> </span><span class="s2">"Jingle"</span><span class="p">],</span><span class="w">
    </span><span class="nl">"Gift Wrapping"</span><span class="p">:</span><span class="w"> </span><span class="p">[</span><span class="s2">"Snowflake"</span><span class="p">,</span><span class="w"> </span><span class="s2">"Sparkle"</span><span class="p">],</span><span class="w">
    </span><span class="nl">"Reindeer Care"</span><span class="p">:</span><span class="w"> </span><span class="p">[</span><span class="s2">"Peppermint"</span><span class="p">]</span><span class="w">
</span><span class="p">}</span><span class="w">
</span></code></pre></div></div>

<h2 id="what-about-for-json">What about <code class="language-plaintext highlighter-rouge">FOR JSON</code>?</h2>

<p>You still have option to use <code class="language-plaintext highlighter-rouge">FOR JSON</code> syntax, but the output may be more verbose and less compact compared to the new aggregate functions.</p>

<div class="language-sql highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="k">SELECT</span> <span class="n">ElfID</span><span class="p">,</span> <span class="n">ElfName</span>
<span class="k">FROM</span> <span class="n">Elves</span>
<span class="k">FOR</span> <span class="n">JSON</span> <span class="n">PATH</span><span class="p">;</span>
</code></pre></div></div>

<p>Output:</p>
<div class="language-json highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="p">[</span><span class="w">
  </span><span class="p">{</span><span class="w">
    </span><span class="nl">"ElfID"</span><span class="p">:</span><span class="w"> </span><span class="mi">1</span><span class="p">,</span><span class="w">
    </span><span class="nl">"ElfName"</span><span class="p">:</span><span class="w"> </span><span class="s2">"Buddy"</span><span class="w">
  </span><span class="p">},</span><span class="w">
  </span><span class="p">{</span><span class="w">
    </span><span class="nl">"ElfID"</span><span class="p">:</span><span class="w"> </span><span class="mi">2</span><span class="p">,</span><span class="w">
    </span><span class="nl">"ElfName"</span><span class="p">:</span><span class="w"> </span><span class="s2">"Jingle"</span><span class="w">
  </span><span class="p">},</span><span class="w">
  </span><span class="p">{</span><span class="w">
    </span><span class="nl">"ElfID"</span><span class="p">:</span><span class="w"> </span><span class="mi">3</span><span class="p">,</span><span class="w">
    </span><span class="nl">"ElfName"</span><span class="p">:</span><span class="w"> </span><span class="s2">"Sparkle"</span><span class="w">
  </span><span class="p">},</span><span class="w">
  </span><span class="p">{</span><span class="w">
    </span><span class="nl">"ElfID"</span><span class="p">:</span><span class="w"> </span><span class="mi">4</span><span class="p">,</span><span class="w">
    </span><span class="nl">"ElfName"</span><span class="p">:</span><span class="w"> </span><span class="s2">"Snowflake"</span><span class="w">
  </span><span class="p">},</span><span class="w">
  </span><span class="p">{</span><span class="w">
    </span><span class="nl">"ElfID"</span><span class="p">:</span><span class="w"> </span><span class="mi">5</span><span class="p">,</span><span class="w">
    </span><span class="nl">"ElfName"</span><span class="p">:</span><span class="w"> </span><span class="s2">"Peppermint"</span><span class="w">
  </span><span class="p">}</span><span class="w">
</span><span class="p">]</span><span class="w">
</span></code></pre></div></div>

<p>While <code class="language-plaintext highlighter-rouge">FOR JSON</code> works well, the new functions like <code class="language-plaintext highlighter-rouge">JSON_ARRAYAGG</code> and <code class="language-plaintext highlighter-rouge">JSON_OBJECTAGG</code> offer cleaner and more flexible options for working with JSON data.</p>

<p>Have fun with elves and JSON!</p>

<h2 id="conclusion-1">Conclusion</h2>

<p>This lightweight post aimed to bring the new functions to your attention, as not everyone works with the cloud and might not be aware of the shiny new features coming your way in the future.</p>

<p>Thank you,</p>

<p>Magda</p>]]></content><author><name>Magda</name></author><category term="english" /><category term="community" /><category term="events" /><category term="azure" /><category term="magda" /><category term="english" /><category term="community" /><category term="events" /><category term="sqlfamily" /><category term="_CloudFamily" /><category term="FestiveTechCalendar" /><category term="tsql" /><category term="magda" /><summary type="html"><![CDATA[Discover the new features introduced this year in Azure SQL Database and Azure SQL Managed Instance. While these features are currently exclusive to the cloud, they may be available in SQL Server soon.]]></summary></entry><entry xml:lang="en"><title type="html">Festive Tech Calendar 2024: My Journey with Data Popkorn</title><link href="http://bronowski.it/festive-tech-calendar-2024-datapopkorn/" rel="alternate" type="text/html" title="Festive Tech Calendar 2024: My Journey with Data Popkorn" /><published>2024-12-03T00:00:00+00:00</published><updated>2024-12-03T00:00:00+00:00</updated><id>http://bronowski.it/festive-tech-calendar-2024-datapopkorn</id><content type="html" xml:base="http://bronowski.it/festive-tech-calendar-2024-datapopkorn/"><![CDATA[<p><img src="/assets/images/20241201-festivetechcalendar2024-popkorn.jpg" alt="DataPopkorn at Festive Tech Calendar 2024" /></p>

<h2 id="a-few-words-about-festive-tech-calendar">A Few Words About Festive Tech Calendar</h2>

<p><a href="https://festivetechcalendar.com/">Festive Tech Calendar 2024</a> is an incredible community initiative by <a href="https://cloudfamily.info">CloudFamily</a>, offering a platform for tech enthusiasts to share their knowledge and passion. This is my fifth contribution to this series, and every year has been an exciting journey. Big thanks to Gregor (<a href="https://gregorsuttie.com">blog</a>|<a href="https://x.com/gregor_suttie">X</a>) and Richard (<a href="https://pixelrobots.co.uk">blog</a>|<a href="https://x.com/Pixel_Robots">X</a>) for running the whole event and letting me be part of it once again!</p>

<p>Please check their <a href="https://www.justgiving.com/page/festive-tech-calendar-2024">JustGiving website</a> where they are raising money for Beatson Cancer Charity.</p>

<h3 id="previous-contributions">Previous contributions</h3>

<p><a href="https://bronowski.it/blog/2020/12/the-ms-excel-an-unexpected-journey-with-powershell">2020: The MS Excel - An Unexpected Journey with PowerShell</a></p>

<p><a href="https://bronowski.it/festive-tech-calendar-2021">2021: Arm Your Bicep with D(i)SC</a></p>

<p><a href="https://www.youtube.com/watch?v=ui5R7eWEmxg">2022: AutomatedLab101</a></p>

<p><a href="https://www.youtube.com/watch?v=_ZLQDhXwlqU">2023: When Python Crashed My Spreadsheet Tea Party</a></p>

<h2 id="introducing-my-first-tech-event-data-popkorn">Introducing My First Tech Event: Data Popkorn</h2>

<h3 id="what-inspired-data-popkorn">What Inspired Data Popkorn?</h3>

<p>Festive Tech Calendar inspired me, alongside community-driven initiatives like <a href="https://tsqltuesday.com/">T-SQL Tuesday</a> (which by the way has a running <a href="https://www.kevinrchant.com/2024/12/03/t-sql-tuesday-181-first-ever-t-sql-tuesday-and-festive-tech-calendar-crossover/">invitation for the next week by Kevin Chant</a>), where contributors share knowledge on a specific theme.</p>

<p>These events encourage contributors to share knowledge on specific themes, and I wanted to create something similar: a platform where data professionals could share bite-sized knowledge asynchronously. The goal was to combine education with accessibility—short, impactful videos that could inspire and be enjoyed anywhere, anytime.</p>

<h2 id="what-is-data-popkorn">What Is Data Popkorn?</h2>

<p>Data Popkorn is a unique platform where data experts present short, impactful videos designed to fit into your busy schedule.</p>

<p>Key Features</p>
<ul>
  <li>100% Free: Knowledge should be accessible to everyone.</li>
  <li>Bite-Sized Content: Videos are capped at 5 minutes, perfect for a coffee break or commute.</li>
  <li>Flexible Viewing: Learn at your own pace and on your schedule.</li>
  <li>Expert Insights: Videos from seasoned data professionals sharing practical tips and tricks.</li>
</ul>

<p>How to Enjoy</p>
<ul>
  <li>Sit back.</li>
  <li>Relax.</li>
  <li>Let the flow of Data Popkorn educate and entertain you!</li>
</ul>

<p><a href="https://www.youtube.com/@datapopkorn">Visit the DataPopkorn YouTube channel here!</a></p>

<h2 id="organizing-data-popkorn-the-popkorn-framework">Organizing Data Popkorn: The P.O.P.K.O.R.N Framework</h2>

<h3 id="p--plan-the-vision">P – Plan the Vision</h3>
<p>Every successful event begins with clear goals. The vision for Data Popkorn was simple:</p>

<ul>
  <li>Make it easy for new speakers or first-time creators to participate.</li>
  <li>Focus on short, impactful knowledge that inspires and engages.</li>
</ul>

<p><strong>Lesson learned: Clearly communicate who is behind the event.</strong></p>

<p>In today’s world, anyone can organize an event, so being transparent about the organizer builds trust and helps presenters decide if they want to participate.</p>

<h3 id="o--organize-the-details">O – Organize the Details</h3>
<p>This was the most challenging phase, involving:</p>

<ul>
  <li>Recruiting speakers from other conferences like (<a href="sqlbits.com">SQLBits</a>, <a href="sqlday.pl">SQLDay</a>, <a href="PassDataCommunitySummit.com">Pass Data Community Summit</a>), as well as identifying emerging professionals.</li>
  <li>Using Sessionize (free for community events) to manage session submissions.</li>
  <li>Collecting videos via OneDrive and scheduling release dates.</li>
  <li>Choosing YouTube as the primary platform for hosting the videos.</li>
  <li>Promoting the event via LinkedIn and other platforms.</li>
  <li>Using ChatGPT for generating illustrations and promotional graphics.</li>
</ul>

<p><strong>Lesson learned: Communication tools matter. Plan for alternatives, as spam filters or platform issues (e.g., OneDrive link issues) can disrupt communication.</strong></p>

<p>Sometimes the emails did not reach the speakers or the selected service was not accessible (for some reason OneDrive links/invitation did not work well with gmail adresses).</p>

<h3 id="p--promote-with-purpose">P – Promote with Purpose</h3>
<ul>
  <li>Promotion relied heavily on LinkedIn, X (Twitter), and YouTube.</li>
</ul>

<p><strong>Lesson learned: Build engagement on all platforms and encourage network sharing.</strong></p>

<p>While external referrals performed well, YouTube’s organic reach needs improvement. Explore additional promotion avenues like the <a href="https://SQLcommunity.Slack.com">SQLcommunity slack</a> or Reddit.</p>

<h3 id="k--keep-the-flow-smooth">K – Keep the Flow Smooth</h3>
<ul>
  <li>Pre-scheduling videos ensured a seamless release process. This approach avoided the stress of live events and allowed for targeted, timely promotions.</li>
</ul>

<p><strong>Lesson learned: Schedule content early to handle potential interruptions (family, health, or work emergencies).</strong></p>

<p>Uploading and scheduling videos takes time, so don’t leave it until the last minute!</p>

<h3 id="o--observe-and-adjust">O – Observe and Adjust</h3>
<ul>
  <li>Technical glitches, such as OneDrive access issues or speakers’ hardware failures.</li>
  <li>Unforeseen personal emergencies (e.g., illness or work conflicts).</li>
  <li>First-time speakers facing difficulties with video editing or audio quality.</li>
</ul>

<p><strong>Lesson learned: Create a group communication space to foster collaboration and support among speakers and organizers.</strong></p>

<p>A place where speakers and organisers can support each other, so it’s a collaborative effort and not individuals left alone with their own issues.</p>

<h3 id="r--reflect-and-improve">R – Reflect and Improve</h3>
<ul>
  <li>Engagement metrics are exciting, but the real value lies in personal growth and meaningful audience feedback.</li>
</ul>

<p><strong>Lesson learned: Don’t obsess over metrics</strong></p>

<p>Focus on creating value and enjoying the process. Numbers are just a by-product.</p>

<h3 id="n--nurture-relationships">N – Nurture Relationships</h3>
<ul>
  <li>The event does not end when the videos are live. Highlighting individual contributions on social media ensures ongoing engagement and builds momentum for future events.</li>
</ul>

<p><strong>Lesson learned: Plan 2–3 future events ahead to maintain continuity and stay organized.</strong></p>

<p>With that in mind, the <a href="https://sessionize.com/datapopkorn2025">Call for Sessions for DataPopkorn 2025 Spring is open</a>.</p>

<h2 id="general-lessons-learned">General lessons learned</h2>
<ul>
  <li>Flexibility is important: Life happens — be kind and supportive of contributors juggling health, family, and work priorities.</li>
  <li>Short and Sweet works: 5-minute videos hit the sweet spot, but adding an optional 1-minute track could encourage even more participation.</li>
  <li>Community is Everything: Many contributors were first-time speakers; fostering a welcoming environment made all the difference.</li>
  <li>Iterate and Improve: From technical platforms to promotional strategies, there is always room to do better next time.</li>
</ul>

<h2 id="thank-you-and-final-thoughts">Thank You and Final Thoughts</h2>
<p>Thank you for reading, and I hope you enjoy the rest of the Festive Tech Calendar content! If this inspires you to host a similar event, go for it—you’ll learn so much along the way.</p>

<h2 id="illustrations">Illustrations</h2>
<p>Shoutout to ChatGPT’s image generation tools for creating visual content. It is proof that you do not need to be a designer to add creative flair to your projects!</p>

<p>Mikey</p>]]></content><author><name>Mikey Bronowski</name></author><category term="english" /><category term="community" /><category term="events" /><category term="azure" /><category term="english" /><category term="community" /><category term="events" /><category term="sqlfamily" /><category term="_CloudFamily" /><category term="FestiveTechCalendar" /><category term="datapopkorn" /><category term="mvpbuzz" /><summary type="html"><![CDATA[Hey there! You know how the tech community has awesome events like FestiveTechCalendar where people share knowledge and grow together? Well, that got me thinking—why not create something fun and bite-sized? That's how DataPopkorn.com was born! It's my little platform where people can share quick tech tricks through short recordings.]]></summary></entry><entry xml:lang="en"><title type="html">T-SQL Tuesday 173 - Has AI Helped You with Your SQL Server Job</title><link href="http://bronowski.it/t-sql-tuesday-173-how-ai-helped-me/" rel="alternate" type="text/html" title="T-SQL Tuesday 173 - Has AI Helped You with Your SQL Server Job" /><published>2024-04-09T00:00:00+01:00</published><updated>2024-04-09T00:00:00+01:00</updated><id>http://bronowski.it/t-sql-tuesday-173-how-ai-helped-me</id><content type="html" xml:base="http://bronowski.it/t-sql-tuesday-173-how-ai-helped-me/"><![CDATA[<p><a href="https://blog.sqlauthority.com/2024/04/02/tsql2sday-invitation-has-ai-helped-you-with-your-sql-server-job/" title="T-SQL Tuesday invitation"><img src="/assets/images/t-sql-tuesday-logo.jpg" alt="T-SQL Tuesday Logo" /></a></p>

<p>This month the #TSQL2SDAY invitation comes from Pinal (<a href="http://twitter.com/pinaldave">X</a>). The T-SQL Tuesday is a monthly blogging event that was created by Adam Machanic (<a href="http://dataeducation.com/">blog</a>|<a href="https://x.com/AdamMachanic">X</a>) and is maintained by Steve Jones (<a href="https://voiceofthedba.wordpress.com/">blog</a>|<a href="https://x.com/way0utwest">X</a>).
Pinal asked us to write about the AI helping at our jobs. The invitation is in <a href="https://blog.sqlauthority.com/2024/04/02/tsql2sday-invitation-has-ai-helped-you-with-your-sql-server-job/">this</a> post.</p>

<p>AI is changing how we work, especially in SQL Server jobs. Tools like ChatGPT, GitHub Copilot, and the upcoming Azure SQL Copilot make our jobs easier. Here is a look at how I use AI, how I wish to use it, and what others think.</p>

<h2 id="how-do-i-use-it">How do I use it?</h2>

<p>Every day, I use ChatGPT and GitHub Copilot. They help me explain complex scripts and speed up my coding. Here is what is great about using AI:</p>
<ul>
  <li><strong>Documentation</strong>: Whenever I finish a task but skip explaining it well, AI comes to the rescue. I do not worry about missing out on documentation anymore.</li>
  <li><strong>Solving Problems</strong>: Before, if I got stuck, it could take ages to find answers because my situation was unique or no one else shared their experience online. Now, AI helps me get on the right track faster, even if it does not have all the answers.</li>
</ul>

<h2 id="how-do-i-want-to-use-it">How do I want to use it?</h2>

<p>I am excited about <a href="https://learn.microsoft.com/en-us/azure/azure-sql/copilot/copilot-azure-sql-overview?view=azuresql">Azure SQL Copilot</a>. It promises to let us ask questions about our databases in simple language and advises on making them run better. Imagine having an AI buddy who could tell you how to improve your database without you having to dig through all the details yourself.</p>

<p>Also, I can’t wait for AI to predict problems before they happen. This means we could fix issues before they turn into bigger problems, keeping our databases safe and running smoothly.</p>

<h2 id="how-do-others-want-to-use-it">How do others want to use it?</h2>

<p>Talking with friends and online, many people are looking forward to using AI in similar ways. They want AI to do the routine checks and analyses, so they can focus on more creative or complex problems. There’s also a lot of interest in making AI smarter at understanding our questions, making it even easier to work with databases.</p>

<p>Everyone agrees that AI should help us, not replace us. We want tools that make our expertise stronger, not unnecessary.</p>

<h2 id="in-conclusion">In Conclusion</h2>
<p>We are just starting to see how AI can help with SQL Server jobs. We can make AI a valuable partner in our work by working together and sharing our ideas.</p>

<p>I would love to hear your thoughts. How do you use AI now, and how do you want to use it in the future? What excites you, and what worries you? The future of AI in our jobs is something we can all help shape. <a href="https://www.linkedin.com/feed/update/urn:li:activity:7168566834630217728/">Check out the conversation I started on LinkedIn</a>  and join in.</p>

<p>Thanks,</p>

<p>Mikey</p>]]></content><author><name>Mikey Bronowski</name></author><category term="english" /><category term="community" /><category term="events" /><category term="tsql2sday" /><category term="english" /><category term="community" /><category term="events" /><category term="sqlfamily" /><category term="tsql2sday" /><summary type="html"><![CDATA[This month the #TSQL2SDAY invitation comes from Pinal Dave who asked us to write about the AI helping at our jobs.]]></summary></entry><entry xml:lang="en"><title type="html">T-SQL Tuesday 171 - Describe the Most Recent Issue You Closed</title><link href="http://bronowski.it/t-sql-tuesday-171-the-most-recent-issue/" rel="alternate" type="text/html" title="T-SQL Tuesday 171 - Describe the Most Recent Issue You Closed" /><published>2024-02-13T00:00:00+00:00</published><updated>2024-02-13T00:00:00+00:00</updated><id>http://bronowski.it/t-sql-tuesday-171-the-most-recent-issue</id><content type="html" xml:base="http://bronowski.it/t-sql-tuesday-171-the-most-recent-issue/"><![CDATA[<p><a href="https://www.brentozar.com/archive/2024/02/tsql2sday-invitation-describe-the-most-recent-issue-you-closed/" title="T-SQL Tuesday invitation"><img src="/assets/images/t-sql-tuesday-logo.jpg" alt="T-SQL Tuesday Logo" /></a></p>

<p>This month the #TSQL2SDAY invitation comes from Brent Ozar (<a href="https://twitter.com/BrentOzarULTD">twitter</a>). The T-SQL Tuesday is a monthly blogging event that was created by Adam Machanic (<a href="http://dataeducation.com/">blog</a>|<a href="https://twitter.com/AdamMachanic">twitter</a>) and is maintained by Steve Jones (<a href="https://voiceofthedba.wordpress.com/">blog</a>|<a href="https://twitter.com/way0utwest">twitter</a>).
Brent asked us to write about the last ticket we closed. The invitation is in <a href="https://www.brentozar.com/archive/2024/02/tsql2sday-invitation-describe-the-most-recent-issue-you-closed/">this</a> post.</p>

<h2 id="how-i-met-your-checkdb">How I Met Your CHECKDB</h2>

<p>Regular execution of DBCC CHECKDB is a cornerstone practice for DBAs, ensuring that databases are free from corruption. However, this routine maintenance can sometimes feel more like a Herculean task, especially when DBCC CHECKDB runs slower than a snail in molasses, or worse, gets terminated because it runs too slow.</p>

<h3 id="love-at-the-first-sight">Love at the First Sight</h3>

<p>It happened multiple times, so this is just an example that I had to tackle recently. DBCC CHECKDB was taking its sweet time, dragging on for hours. The solution: kill it at a certain point or stop running at all. Not ideal.</p>

<h3 id="what-now">What Now?</h3>

<p>The DBCC was running in a single SQL Agent job (using <a href="https://ola.hallengren.com/sql-server-integrity-check.html">maintenance solution</a>). So the first idea was to…</p>

<h4 id="divide-and-conquer">Divide and Conquer</h4>

<p>Create a dedicated SQL Agent job for each of the top three biggest databases, and one for the remaining set (including system databases). Great! At least we’re going somewhere. Some improvement, but not much, there was more to do.</p>

<h3 id="the-art-of-dbcc-operations">The Art of DBCC Operations</h3>

<p>Even with this segregation, the DBCC of the three largest databases was still slow. The solution? Dissect DBCC CHECKDB into its subcommands: CHECKALLOC, CHECKTABLE, and CHECKCATALOG. Worked pretty nicely. Thanks to the metrics gathered in the CommandLog table the surprise was identified. CHECKTABLE of the third database took a fraction of the time to process compared to the full CHECKDB. What the (c)heck?</p>

<h3 id="the-service-broker-conundrum">The Service Broker Conundrum</h3>

<p>While the full CHECKDB was running we could see lots of time being spent on DBCC SSB CHECK, meaning SQL Service Broker objects are checked. This does not happen when <a href="https://learn.microsoft.com/en-us/sql/t-sql/database-console-commands/dbcc-transact-sql">CHECKTABLE is being executed</a>. Mystery solved, upon confirming that the service broker is some sort of legacy in that system, the database was excluded from the full CHECKDB for good.</p>

<h3 id="its-raining-snapshots">It’s raining Snapshots</h3>

<p>After investigating the second top database it was clear that a large number of snapshots between CHECKTABLE operations added up to hours quickly. Over 400 tables. The solution here - TABLOCK which would obtain a shared lock instead of an internal database snapshot. As it occurred only 15 tables were big enough to be affected, so over 375 tables below 1 GB could use <a href="https://learn.microsoft.com/en-us/sql/t-sql/database-console-commands/dbcc-checktable-transact-sql?view=sql-server-ver16#tablock">TABLOCK</a>, the others were running with snapshots. That decreased processing time dramatically.</p>

<p>It created another job, for that database, one with bigger tables and one with smaller tables picked up dynamically based on the size at the execution time, so they were allocated to a dedicated bucket.</p>

<h3 id="its-not-a-good-time">It’s not a good time</h3>

<p>After all that work and many SQL Agent jobs, a closer look at activity it was worth trying to move it a bit to avoid rush hours. That proved to be a good idea in this environment, as pushing it by one hour later further reduced DBCC time (by ~30%).</p>

<h2 id="conclusion">Conclusion</h2>

<p>It was a great excercise and the environment got more granural SQL Agent jobs to successfully perform database integrity checks. One thing to remember, the dbi_dbccLastKnownGood value was not updated when the piecemeal DBCC was executed. Read more about that <a href="https://www.sqlskills.com/blogs/erin/what-checks-update-dbcclastknowngood/">here</a>.</p>

<p>Thanks,</p>

<p>Mikey</p>]]></content><author><name>Mikey Bronowski</name></author><category term="english" /><category term="community" /><category term="events" /><category term="tsql2sday" /><category term="english" /><category term="community" /><category term="events" /><category term="sqlfamily" /><category term="tsql2sday" /><summary type="html"><![CDATA[This month the #TSQL2SDAY invitation comes from Brent Ozar who asked us to write about the last ticket we closed.]]></summary></entry><entry xml:lang="en"><title type="html">T-SQL Tuesday 163 - What is the best piece of Career Advice you ever received</title><link href="http://bronowski.it/t-sql-tuesday-163-what-is-the-best-piece-of-career-advice-you-ever-received/" rel="alternate" type="text/html" title="T-SQL Tuesday 163 - What is the best piece of Career Advice you ever received" /><published>2023-06-20T00:00:00+01:00</published><updated>2023-06-20T00:00:00+01:00</updated><id>http://bronowski.it/t-sql-tuesday-163-what-is-the-best-piece-of-career-advice-you-ever-received</id><content type="html" xml:base="http://bronowski.it/t-sql-tuesday-163-what-is-the-best-piece-of-career-advice-you-ever-received/"><![CDATA[<p><a href="https://www.gethynellis.com/2023/06/t-sql-tuesday-163-invitation-what-is-the-best-piece-of-career-advice-you-ever-received.html" title="T-SQL Tuesday invitation"><img src="/assets/images/t-sql-tuesday-logo.jpg" alt="T-SQL Tuesday Logo" /></a></p>

<p>This month the #TSQL2SDAY invitation comes from Gethyn Ellis (<a href="https://twitter.com/gethyn_ellis">twitter</a>). The T-SQL Tuesday is a monthly blogging event that was created by Adam Machanic (<a href="http://dataeducation.com/">blog</a>|<a href="https://twitter.com/AdamMachanic">twitter</a>) and is maintained by Steve Jones (<a href="https://voiceofthedba.wordpress.com/">blog</a>|<a href="https://twitter.com/way0utwest">twitter</a>).
Gethyn Ellis asks us to write about the best piece of Career Advice we ever received. The invitation is in <a href="https://www.gethynellis.com/2023/06/t-sql-tuesday-163-invitation-what-is-the-best-piece-of-career-advice-you-ever-received.html">this</a> post.</p>

<h2 id="escaping-the-clutches-of-a-shiy-job">Escaping the Clutches of a Shi++y Job</h2>

<p>Let’s face it - spending a significant chunk of our lives in a “shi++y” job is a recipe for misery. Who wants that? In this provocative blog, we explore the notion that life is simply too short to waste on a soul-sucking job.</p>

<h3 id="escaping-the-abyss-of-monotony">Escaping the Abyss of Monotony</h3>

<p>Imagine being stuck in a job that drains your energy faster than a vampire at an all-you-can-eat blood buffet. I once met a person who ditched their miserable job for a lower paycheck, and you know what? They seemed happier than a pig in the mud. Sure, there were places where I ended up working longer than a geologic era, thanks to terrible planning or staff shortages. I even spent holidays secretly fixing tech glitches in a hidden corner. It was like living in a twisted version of “Home Alone.” Trust me, if you’re feeling frustrated and turning into an insufferable grouch, it’s time to seek greener pastures - as long as you can still pay the bills, of course.</p>

<h3 id="the-magic-of-hanging-with-geniuses">The Magic of Hanging with Geniuses</h3>

<p>Surrounding yourself with brilliant minds can be a game-changer. I mean, who doesn’t love working with people who make you feel like an intellectual muggle in comparison? In every workplace I’ve been in, I made sure to find at least two brainiacs who could teach me a thing or two. It’s like having Dumbledore and Gandalf as colleagues (minus the magical powers, sadly). But hey, if you’re struggling to find those awe-inspiring individuals, consider joining a local user group. Who knows, you might find your intellectual soulmates and finally have someone to geek out with during lunch breaks.</p>

<h3 id="the-secret-karma-of-sharing-knowledge">The Secret Karma of Sharing Knowledge</h3>

<p>Do you want recognition? Do you want to be revered like the god(dess) of data? Well, here’s a secret: share your knowledge with the world! Whether it’s through a witty blog post, an entertaining video, or a conference talk that leaves people rolling in the aisles, spreading your wisdom will come back to you like a boomerang of appreciation. Teach others, and you’ll find yourself learning more than you ever imagined. It’s like being a superhero, but instead of saving lives, you save people from boring, uninformed existence. Plus, who knows, you might even become the Beyoncé of the data community. #DataQueen (Note: crown not included.)</p>

<h2 id="conclusion">Conclusion</h2>
<p>Life’s too short to spend it trapped in a soul-crushing job that makes you question your sanity. Seek happiness in your career, surround yourself with brilliant minds, and share your knowledge with the world. Good luck!</p>

<p>Mikey</p>]]></content><author><name>Mikey Bronowski</name></author><category term="english" /><category term="community" /><category term="events" /><category term="tsql2sday" /><category term="english" /><category term="community" /><category term="events" /><category term="sqlfamily" /><category term="tsql2sday" /><summary type="html"><![CDATA[This month the #TSQL2SDAY invitation comes from Gethyn Ellis who asks us to write about the best piece of Career Advice we ever received.]]></summary></entry><entry xml:lang="en"><title type="html">The SQLBits 2023 experience</title><link href="http://bronowski.it/sqlbits2023-experience/" rel="alternate" type="text/html" title="The SQLBits 2023 experience" /><published>2023-04-02T00:00:00+01:00</published><updated>2023-04-02T00:00:00+01:00</updated><id>http://bronowski.it/sqlbits2023-experience</id><content type="html" xml:base="http://bronowski.it/sqlbits2023-experience/"><![CDATA[<h1 id="hat-rack">Hat rack</h1>

<p><img src="/assets/images/2023-04-02-sqlbits2023-experience/dsc1193-flashback.jpg" alt="SQLBits 2023" /></p>

<p>Ah, SQLBits, my old friend! I recently attended the 2023 event, and boy was it a doozy. Just like last year, I found myself wearing many different hats at the conference. In fact, I wore so many hats that I started to feel like a hat rack! This was actually my third time attending SQLBits in person, and I have to say, it just keeps getting better and better. Talk about multitasking! (sorry Linda)
So, what exactly changed this year?</p>

<h2 id="location">Location</h2>
<p><img src="/assets/images/2023-04-02-sqlbits2023-experience/dsc4317-cymru.jpg" alt="SQLBits 2023" /></p>

<p>SQLBits 2023 had taken place in Newport, Wales and once it was announced it caused a small tsunami online. It wasn’t that big of a deal for us, as we were driving there, but due to several unpleasant circumstances (strikes, weather), it could cause some disruption or stress to the attendees. Despite the potential obstacles, I have to say that it was worth it. We got to explore a side of the country that we had never seen before, and it was simply stunning. I definitely plan on coming back to Wales, although maybe next time I’ll wait until the rainy season is over. Does the rainy season ever end in Wales? Someone please tell me it does… nervous laughter</p>

<h2 id="dd">D&amp;D</h2>
<p><img src="/assets/images/2023-04-02-sqlbits2023-experience/dsc7142-dice.jpg" alt="SQLBits 2023" /></p>

<p>SQLBits 2023 took me on quite the adventure with its Dungeons &amp; Dragons theme! Even though I’m not exactly a D&amp;D enthusiast, I have to admit that I had a blast. It was a refreshing change of pace from the usual tech conference scene.</p>

<p>I mean, what’s not to love? We got to roll dice, explore imaginary worlds, and battle fierce monsters (okay, maybe not actual monsters, but you get the idea). Plus, I now have a collection of dice at home that could rival any seasoned D&amp;D player.</p>

<h2 id="parent">Parent</h2>

<p>SQLBits really outdid themselves this year by offering a crèche for parents who needed childcare. I have to say, this was a game-changer for me and my partner Magda. It was amazing to be able to focus on our roles at the event without having to worry about our child’s wellbeing.</p>

<p>What was truly unique about this was that the crèche was available for the entire duration of the conference, including precon days. I’ve never encountered such a service at any other conference before, and I’m so glad that SQLBits decided to carry on with it.</p>

<p>Not only did it make our lives easier, but our child also had a great time. They got to enjoy rainy walks around the venue and even made a wooden dragon as a craft project! And they weren’t the only ones - there were a couple of other children in the crèche as well, so they had company and didn’t feel lonely.</p>

<p>Overall, I’m so grateful for the crèche service at SQLBits. It really made a huge difference and allowed us to fully enjoy the conference without any worries.</p>

<h2 id="orange-helper">Orange helper</h2>

<p><img src="/assets/images/2023-04-02-sqlbits2023-experience/dsc0381-orange.jpg" alt="SQLBits 2023" /></p>

<p>Ah, the infamous orange shirts of the SQLBits crew! This was my second year wearing one, and let me tell you, it’s quite the experience. Being a part of the crew is truly something special, even if it means starting your day extra early before everyone else arrives at the venue.</p>

<p>But you know what? It’s worth it. The support we received from the committee, the tools provided to us, and all the preparation that went into the event months ahead of time made the experience truly unforgettable.</p>

<p>It’s amazing to see the sea of orange shirts bustling around the venue, making sure everything runs smoothly.</p>

<p>All in all, being a part of the crew at SQLBits is an experience I’ll never forget, and I can’t wait to do it all again next year!</p>

<h2 id="speaker">Speaker</h2>

<p><img src="/assets/images/2023-04-02-sqlbits2023-experience/dsc6659-speaker.jpg" alt="SQLBits 2023" /></p>

<p>Wow, I still can’t believe I was selected as a speaker at SQLBits 2023! It was such an incredible honor and a pleasure to be able to share my knowledge and experiences with others in the community.</p>

<p>Even though I had a shorter format (only 20 minutes), I have to admit that it still raised my adrenaline levels. But hey, that’s all part of the thrill, right? I’m so grateful to everyone who attended my session and asked such thoughtful questions.</p>

<p>If you missed my talk, don’t worry - I believe it’s available on Canapii. And of course, a huge thank you to my partner Magda for capturing this photo of me in action.</p>

<h2 id="attendee">Attendee</h2>

<blockquote class="twitter-tweet"><p lang="en" dir="ltr">Celebrating <a href="https://twitter.com/SQLGeordie?ref_src=twsrc%5Etfw">@SQLGeordie</a> ‘s birthday together in Wales at <a href="https://twitter.com/SQLBits?ref_src=twsrc%5Etfw">@SQLBits</a> with almost the complete team! ❤️ <a href="https://t.co/46eleJZfOW">pic.twitter.com/46eleJZfOW</a></p>&mdash; datamasterminds (@datamasterminds) <a href="https://twitter.com/datamasterminds/status/1636465085609549845?ref_src=twsrc%5Etfw">March 16, 2023</a></blockquote>
<script async="" src="https://platform.twitter.com/widgets.js" charset="utf-8"></script>

<p>Networking at events like SQLBits is truly invaluable! There’s so much you can learn just from chatting with fellow attendees and visiting the sponsor booths. You never know what new tool or technology you might discover.</p>

<p>But it’s not just about the new tools - it’s also a great opportunity to reconnect with old colleagues or meet potential future ones. In fact, my first SQLBits experience was with a colleague from the same company. Over the years, we went our separate ways and worked for different places, but this time we were able to reconnect as colleagues once again. It’s a small world, after all!</p>

<p>So, my advice to anyone attending a conference like this is to take advantage of every opportunity to connect with others and learn something new. Who knows where it might lead you in the future?</p>

<h2 id="snapper">Snapper</h2>

<p>I’ve been putting my photography skills to the test and snapping shots left and right. It’s been a blast, and I can’t wait for you to check out my work on <a href="https://www.flickr.com/MikeyBronowski">Flickr</a>.  but here I wanted to share work I did at SQLBits. Below are links to the days I attended. If you like any photos, or you find yourself or your friends there, feel free to use them on social media. I only ask for one thing - tag me, please. This way I know you liked them :-)</p>

<p><a href="https://www.flickr.com/gp/mikeybronowski/798KAi4Z05">2023-03-16 Wednesday</a></p>

<p><a href="https://www.flickr.com/gp/mikeybronowski/4is5m054G3">2023-03-17 Thursday</a></p>

<p><a href="https://www.flickr.com/gp/mikeybronowski/L615w331LU">2023-03-18 Friday</a></p>

<p><a href="https://www.flickr.com/gp/mikeybronowski/PMh3Y3eZyH">2023-03-18 Friday Party</a></p>

<p><a href="https://www.flickr.com/gp/mikeybronowski/Q6u802rf0f">2023-03-19 Saturday</a></p>

<h1 id="conclusion">Conclusion</h1>

<p><img src="/assets/images/2023-04-02-sqlbits2023-experience/dsc0248-buddy.jpg" alt="SQLBits 2023" /></p>

<p>And that’s a wrap on SQLBits 2023! It was an unforgettable experience, and I’m already counting down the days until next year’s conference.</p>

<p>Having been to a few other big conferences in the past, I can honestly say that SQLBits is something special. It’s not just a place to speak, attend sessions, and party (although those are definitely perks) - it’s a place where you can feel safe, accepted, and like you truly belong.</p>

<p>So, a huge thank you to everyone who made SQLBits 2023 such an amazing experience. Here’s to SQLBits, the community, and all the amazing things that are yet to come!</p>

<p>Mikey</p>]]></content><author><name>Mikey Bronowski</name></author><category term="english" /><category term="community" /><category term="events" /><category term="english" /><category term="community" /><category term="events" /><category term="sqlfamily" /><category term="sqlbits" /><category term="conference" /><category term="inperson" /><summary type="html"><![CDATA[In March 2023 we visited Newport, Wales to attend our third in-person SQLBits. Here is how it was for us.]]></summary></entry><entry xml:lang="en"><title type="html">T-SQL Tuesday 159 - What’s Your Favorite New Feature? - Magda</title><link href="http://bronowski.it/t-sql-tuesday-159-favourite-sql-server-2022-feature-magda/" rel="alternate" type="text/html" title="T-SQL Tuesday 159 - What’s Your Favorite New Feature? - Magda" /><published>2023-02-14T00:00:00+00:00</published><updated>2023-02-14T00:00:00+00:00</updated><id>http://bronowski.it/t-sql-tuesday-159-favourite-sql-server-2022-feature-magda</id><content type="html" xml:base="http://bronowski.it/t-sql-tuesday-159-favourite-sql-server-2022-feature-magda/"><![CDATA[<p><a href="https://dbanuggets.com/2023/02/05/t-sql-tuesday-159-invitation-whats-your-new-favorite-feature/" title="T-SQL Tuesday invitation"><img src="/assets/images/t-sql-tuesday-logo.jpg" alt="T-SQL Tuesday Logo" /></a></p>

<p>This month the #TSQL2SDAY invitation comes from Deepthi Goguri (<a href="http://tsqltuesday.com/2023/02/07/t-sql-tuesday-159-whats-your-favorite-new-feature/">blog</a>|<a href="https://twitter.com/dbanuggets">twitter</a>) who asks us to write about our favorite new feature in SQL Server 2022 or in Azure and New Year’s Resolutions. The T-SQL Tuesday is a monthly blogging event that was created by Adam Machanic (<a href="http://dataeducation.com/">blog</a>) and is maintained by Steve Jones (<a href="https://voiceofthedba.wordpress.com/">blog</a>|<a href="https://twitter.com/way0utwest">twitter</a>).</p>

<p>If you want to find out about my New Year’s Resolutions <a href="/t-sql-tuesday-159-new-years-resolutions-magda/">read this post</a>.</p>

<p>There are many new features in SQL Server 2022, I’ve done my research, and I found quite several updates and new features that really interest me, and there were mostly features about the <a href="https://learn.microsoft.com/en-us/sql/sql-server/what-s-new-in-sql-server-2022?view=sql-server-ver16#language">Language</a>, the new/updated T-SQL functions such as:</p>

<h2 id="datetrunc">DATETRUNC()</h2>

<p>From MS Learn:</p>
<blockquote>
  <p>DATETRUNC() function returns an input date truncated to a specified datepart.</p>
</blockquote>

<p>On the surface the work similarly to <code class="language-plaintext highlighter-rouge">DATEPART()</code>, however that function returns integer values, opposed to the dates returned by <code class="language-plaintext highlighter-rouge">DATETRUNC()</code> (we will see that better in the example below).</p>

<p>Let’s consider a query:</p>
<div class="language-sql highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="k">declare</span> <span class="o">@</span><span class="n">d</span> <span class="n">datetime2</span> <span class="o">=</span> <span class="s1">'2023-02-14 23:02:14.2302149'</span><span class="p">;</span>
<span class="k">select</span> <span class="s1">'10 - Year'</span> <span class="n">part</span><span class="p">,</span> <span class="n">DATETRUNC</span><span class="p">(</span><span class="nb">year</span><span class="p">,</span> <span class="o">@</span><span class="n">d</span><span class="p">)</span> <span class="n">dateTRUNC</span> <span class="p">,</span> <span class="n">DATEPART</span><span class="p">(</span><span class="nb">year</span><span class="p">,</span> <span class="o">@</span><span class="n">d</span><span class="p">)</span> <span class="n">datePART</span>
<span class="k">union</span>
<span class="k">select</span> <span class="s1">'11 - Quarter'</span><span class="p">,</span> <span class="n">DATETRUNC</span><span class="p">(</span><span class="n">quarter</span><span class="p">,</span> <span class="o">@</span><span class="n">d</span><span class="p">),</span> <span class="n">DATEPART</span><span class="p">(</span><span class="n">quarter</span><span class="p">,</span> <span class="o">@</span><span class="n">d</span><span class="p">)</span>
<span class="k">union</span>
<span class="k">select</span> <span class="s1">'12 - Month'</span><span class="p">,</span> <span class="n">DATETRUNC</span><span class="p">(</span><span class="k">month</span><span class="p">,</span> <span class="o">@</span><span class="n">d</span><span class="p">),</span> <span class="n">DATEPART</span><span class="p">(</span><span class="k">month</span><span class="p">,</span> <span class="o">@</span><span class="n">d</span><span class="p">)</span>
<span class="k">union</span>
<span class="k">select</span> <span class="s1">'13 - Week'</span><span class="p">,</span> <span class="n">DATETRUNC</span><span class="p">(</span><span class="n">week</span><span class="p">,</span> <span class="o">@</span><span class="n">d</span><span class="p">),</span> <span class="n">DATEPART</span><span class="p">(</span><span class="n">week</span><span class="p">,</span> <span class="o">@</span><span class="n">d</span><span class="p">)</span> <span class="c1">-- For a U.S. English environment, @@DATEFIRST defaults to 7 (Sunday).</span>
<span class="k">union</span>
<span class="k">select</span> <span class="s1">'14 - Iso_week'</span><span class="p">,</span> <span class="n">DATETRUNC</span><span class="p">(</span><span class="n">iso_week</span><span class="p">,</span> <span class="o">@</span><span class="n">d</span><span class="p">),</span> <span class="n">DATEPART</span><span class="p">(</span><span class="n">iso_week</span><span class="p">,</span> <span class="o">@</span><span class="n">d</span><span class="p">)</span>
<span class="k">union</span>
<span class="k">select</span> <span class="s1">'15 - DayOfYear'</span><span class="p">,</span> <span class="n">DATETRUNC</span><span class="p">(</span><span class="n">dayofyear</span><span class="p">,</span> <span class="o">@</span><span class="n">d</span><span class="p">),</span> <span class="n">DATEPART</span><span class="p">(</span><span class="n">dayofyear</span><span class="p">,</span> <span class="o">@</span><span class="n">d</span><span class="p">)</span> 
<span class="k">union</span>
<span class="k">select</span> <span class="s1">'16 - Day'</span><span class="p">,</span> <span class="n">DATETRUNC</span><span class="p">(</span><span class="k">day</span><span class="p">,</span> <span class="o">@</span><span class="n">d</span><span class="p">),</span>  <span class="n">DATEPART</span><span class="p">(</span><span class="k">day</span><span class="p">,</span> <span class="o">@</span><span class="n">d</span><span class="p">)</span>
<span class="k">union</span>
<span class="k">select</span> <span class="s1">'17 - Hour'</span><span class="p">,</span> <span class="n">DATETRUNC</span><span class="p">(</span><span class="n">hour</span><span class="p">,</span> <span class="o">@</span><span class="n">d</span><span class="p">),</span> <span class="n">DATEPART</span><span class="p">(</span><span class="n">hour</span><span class="p">,</span> <span class="o">@</span><span class="n">d</span><span class="p">)</span>
<span class="k">union</span>
<span class="k">select</span> <span class="s1">'18 - Minute'</span><span class="p">,</span> <span class="n">DATETRUNC</span><span class="p">(</span><span class="k">minute</span><span class="p">,</span> <span class="o">@</span><span class="n">d</span><span class="p">),</span> <span class="n">DATEPART</span><span class="p">(</span><span class="k">minute</span><span class="p">,</span> <span class="o">@</span><span class="n">d</span><span class="p">)</span>
<span class="k">union</span>
<span class="k">select</span> <span class="s1">'19 - Second'</span><span class="p">,</span> <span class="n">DATETRUNC</span><span class="p">(</span><span class="k">second</span><span class="p">,</span> <span class="o">@</span><span class="n">d</span><span class="p">),</span> <span class="n">DATEPART</span><span class="p">(</span><span class="k">second</span><span class="p">,</span> <span class="o">@</span><span class="n">d</span><span class="p">)</span>
<span class="k">union</span>
<span class="k">select</span> <span class="s1">'20 - Millisecond'</span><span class="p">,</span> <span class="n">DATETRUNC</span><span class="p">(</span><span class="n">millisecond</span><span class="p">,</span> <span class="o">@</span><span class="n">d</span><span class="p">),</span> <span class="n">DATEPART</span><span class="p">(</span><span class="n">millisecond</span><span class="p">,</span> <span class="o">@</span><span class="n">d</span><span class="p">)</span>
<span class="k">union</span>
<span class="k">select</span> <span class="s1">'21 - Microsecond'</span><span class="p">,</span> <span class="n">DATETRUNC</span><span class="p">(</span><span class="n">microsecond</span><span class="p">,</span> <span class="o">@</span><span class="n">d</span><span class="p">),</span> <span class="n">DATEPART</span><span class="p">(</span><span class="n">microsecond</span><span class="p">,</span> <span class="o">@</span><span class="n">d</span><span class="p">);</span>
</code></pre></div></div>

<p>And the results are as below:</p>
<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>part	            dateTRUNC	                    datePART
----                ---------                       --------
10 - Year		2023-01-01 00:00:00.0000000	    2023
11 - Quarter		2023-01-01 00:00:00.0000000	    1
12 - Month		2023-02-01 00:00:00.0000000	    2
13 - Week		2023-02-12 00:00:00.0000000	    7
14 - Iso_week		2023-02-13 00:00:00.0000000	    7
15 - DayOfYear		2023-02-14 00:00:00.0000000	    45
16 - Day		2023-02-14 00:00:00.0000000	    14
17 - Hour		2023-02-14 23:00:00.0000000	    23
18 - Minute		2023-02-14 23:02:00.0000000	    2
19 - Second		2023-02-14 23:02:14.0000000	    14
20 - Millisecond	2023-02-14 23:02:14.2300000	    230
21 - Microsecond	2023-02-14 23:02:14.2302140	    230214
</code></pre></div></div>

<p>So clearly we see the difference between the values returned by the two functions.</p>

<p>One thing to note is that for <code class="language-plaintext highlighter-rouge">Iso_week</code> the first day of the week in the ISO8601 calendar system is Monday, while <code class="language-plaintext highlighter-rouge">Week</code> uses by default Sunday For a U.S. English environment.</p>

<h2 id="least--greatest">LEAST() &amp; GREATEST()</h2>

<p>From MS Learn:</p>
<blockquote>
  <p>The <code class="language-plaintext highlighter-rouge">LEAST()</code> &amp; <code class="language-plaintext highlighter-rouge">GREATEST()</code> functions return the minimum / maximum value from a list of one or more expressions.</p>
</blockquote>

<p>If the data type is various then in the return I will receive the data type of the highest value before comparison. It is similar to <code class="language-plaintext highlighter-rouge">MAX()</code> and <code class="language-plaintext highlighter-rouge">MIN()</code> functions, however <code class="language-plaintext highlighter-rouge">LEAST()</code> &amp; <code class="language-plaintext highlighter-rouge">GREATEST()</code> accept more arguments  (up to 254) and they work differently on columns.</p>

<p>Let’s consider this example with multiple arguments:</p>

<div class="language-sql highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="k">create</span> <span class="k">table</span> <span class="n">tsql2sday</span> <span class="p">(</span><span class="n">s1</span> <span class="nb">int</span><span class="p">,</span> <span class="n">s2</span> <span class="nb">int</span><span class="p">,</span> <span class="n">s3</span> <span class="nb">int</span><span class="p">);</span>
<span class="k">insert</span> <span class="k">into</span> <span class="n">tsql2sday</span> <span class="k">values</span> <span class="p">(</span><span class="mi">2</span><span class="p">,</span><span class="mi">1</span><span class="p">,</span><span class="mi">3</span><span class="p">),(</span><span class="mi">5</span><span class="p">,</span><span class="mi">4</span><span class="p">,</span><span class="mi">3</span><span class="p">),(</span><span class="mi">4</span><span class="p">,</span><span class="mi">2</span><span class="p">,</span><span class="mi">3</span><span class="p">),(</span><span class="mi">40</span><span class="p">.</span><span class="mi">1</span><span class="p">,</span><span class="mi">110</span><span class="p">.</span><span class="mi">12</span><span class="p">,</span><span class="mi">398</span><span class="p">.</span><span class="mi">1</span><span class="p">);</span>
<span class="k">select</span> <span class="o">*</span><span class="p">,</span> <span class="n">least</span><span class="p">(</span><span class="n">s1</span><span class="p">,</span><span class="n">s2</span><span class="p">,</span><span class="n">s3</span><span class="p">)</span> <span class="n">least</span><span class="p">,</span> <span class="n">greatest</span><span class="p">(</span><span class="n">s1</span><span class="p">,</span><span class="n">s2</span><span class="p">,</span><span class="n">s3</span><span class="p">)</span> <span class="n">greatest</span> <span class="k">from</span> <span class="n">tsql2sday</span><span class="p">;</span>
</code></pre></div></div>

<p>The results show that <code class="language-plaintext highlighter-rouge">LEAST()</code> &amp; <code class="language-plaintext highlighter-rouge">GREATEST()</code> work horizontally:</p>
<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>s1	s2	s3	least	greatest
--	--	--	-----	--------
2	1	3	1	3
5	4	3	3	5
4	2	3	2	4
40	110	398	40	398
</code></pre></div></div>

<h2 id="string_split">STRING_SPLIT()</h2>

<p>From MS Learn:</p>
<blockquote>
  <p>A table-valued function that splits a string into rows of substrings, based on a specified separator character.</p>
</blockquote>

<p>The STRING_SPLIT() is not new, but has been updated in SQL Server 2022 with <code class="language-plaintext highlighter-rouge">enable_ordinal</code> argument and <code class="language-plaintext highlighter-rouge">ordinal</code> output column. Again from the MS Learn:</p>

<blockquote>
  <p><code class="language-plaintext highlighter-rouge">enable_ordinal</code> serves as a flag to enable or disable the <code class="language-plaintext highlighter-rouge">ordinal</code> output column. A value of 1 enables the <code class="language-plaintext highlighter-rouge">ordinal</code> column. If <code class="language-plaintext highlighter-rouge">enable_ordinal</code> is omitted, <code class="language-plaintext highlighter-rouge">NULL</code>, or has a value of 0, the <code class="language-plaintext highlighter-rouge">ordinal</code> column is disabled.</p>
</blockquote>

<p>Let’s have a look at this query:</p>
<div class="language-sql highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="k">SELECT</span> <span class="o">*</span> <span class="k">FROM</span> <span class="n">STRING_SPLIT</span><span class="p">(</span><span class="s1">'This month the #TSQL2SDAY invitation comes from Deepthi Goguri'</span><span class="p">,</span><span class="s1">' '</span><span class="p">);</span>
</code></pre></div></div>
<p>and the results would be in a single column,</p>
<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>value
-----
This
month
the
#TSQL2SDAY
invitation
comes
from
Deepthi
Goguri
</code></pre></div></div>

<p>but starting from SQL Server 2022 we can add this extra argument to enable the <code class="language-plaintext highlighter-rouge">ordinal</code> column in the output:</p>
<div class="language-sql highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="k">select</span> <span class="o">*</span> <span class="k">from</span> <span class="n">STRING_SPLIT</span><span class="p">(</span><span class="s1">'This month the #TSQL2SDAY invitation comes from Deepthi Goguri'</span><span class="p">,</span><span class="s1">' '</span><span class="p">,</span> <span class="mi">1</span><span class="p">);</span>
</code></pre></div></div>

<p>and now we got more information:</p>
<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>value	    ordinal
-----       -------
This	    1
month	    2
the	        3
#TSQL2SDAY	4
invitation	5
comes	    6
from	    7   
Deepthi	    8
Goguri	    9
</code></pre></div></div>

<p>Thanks,
Magda</p>]]></content><author><name>Magda</name></author><category term="english" /><category term="community" /><category term="events" /><category term="tsql2sday" /><category term="magda" /><category term="english" /><category term="community" /><category term="events" /><category term="sqlfamily" /><category term="tsql2sday" /><category term="sqlserver2022" /><summary type="html"><![CDATA[This month the #TSQL2SDAY invitation comes from Deepthi Goguri who asks us to write about our favorite new feature in SQL Server 2022 or in Azure and New Year's Resolutions.]]></summary></entry><entry xml:lang="en"><title type="html">T-SQL Tuesday 159 - New Year’s Resolutions - Magda</title><link href="http://bronowski.it/t-sql-tuesday-159-new-years-resolutions-magda/" rel="alternate" type="text/html" title="T-SQL Tuesday 159 - New Year’s Resolutions - Magda" /><published>2023-02-14T00:00:00+00:00</published><updated>2023-02-14T00:00:00+00:00</updated><id>http://bronowski.it/t-sql-tuesday-159-new-years-resolutions-magda</id><content type="html" xml:base="http://bronowski.it/t-sql-tuesday-159-new-years-resolutions-magda/"><![CDATA[<p><a href="https://dbanuggets.com/2023/02/05/t-sql-tuesday-159-invitation-whats-your-new-favorite-feature/" title="T-SQL Tuesday invitation"><img src="/assets/images/t-sql-tuesday-logo.jpg" alt="T-SQL Tuesday Logo" /></a></p>

<p>This month the #TSQL2SDAY invitation comes from Deepthi Goguri (<a href="http://tsqltuesday.com/2023/02/07/t-sql-tuesday-159-whats-your-favorite-new-feature/">blog</a>|<a href="https://twitter.com/dbanuggets">twitter</a>) who asks us to write about our favorite new feature in SQL Server 2022 or in Azure and New Year’s Resolutions. The T-SQL Tuesday is a monthly blogging event that was created by Adam Machanic (<a href="http://dataeducation.com/">blog</a>) and is maintained by Steve Jones (<a href="https://voiceofthedba.wordpress.com/">blog</a>|<a href="https://twitter.com/way0utwest">twitter</a>).</p>

<p>If you want to read about my favourite new feature in SQL Server 2022 <a href="/t-sql-tuesday-159-favourite-sql-server-2022-feature-magda/">read this post</a>.</p>

<h2 id="new-resolutions">New Resolutions</h2>
<p>I thought I can write another post about the second Deepthi Goguri’s  topic about the New year, New Resolutions.</p>

<p>I usually did not have any resolutions, because when I would like to do something I just do it, spontaneously, without planning, or crossing days in the calendar. If this was a success - that’s cool if I failed, wiped tears, and have no regrets because my year has not been ruined. I found this fair for myself.</p>

<p>But I have a few resolutions, a few things that I would like to do in the next months.</p>

<h2 id="microsoft-certifications">Microsoft Certifications</h2>
<p>I would like to find time to learn and pass the exam for MS certifications, I am thinking of 2 exams - but will see.</p>

<h2 id="workout-wednesday">Workout Wednesday</h2>
<p>The second is quite fresh because I found this workout last week and I would like to give it a try. This would be a weekly workout about PowerBi, and this can be found here: <a href="https://workout-wednesday.com/">Workout-Wednesday.com</a>. I need to catch up on a few lessons from the beginning of the year, but I hope I will be up to date soon with all this year’s lessons, and there will be another 48 to go.</p>

<p>Thanks,</p>

<p>Magda</p>]]></content><author><name>Magda</name></author><category term="english" /><category term="community" /><category term="events" /><category term="tsql2sday" /><category term="magda" /><category term="english" /><category term="community" /><category term="events" /><category term="sqlfamily" /><category term="tsql2sday" /><summary type="html"><![CDATA[This month the #TSQL2SDAY invitation comes from Deepthi Goguri who asks us to write about our favorite new feature in SQL Server 2022 or in Azure and New Year's Resolutions.]]></summary></entry><entry xml:lang="en"><title type="html">T-SQL Tuesday 150 - My first technical job</title><link href="http://bronowski.it/t-sql-tuesday-150-my-first-technical-job/" rel="alternate" type="text/html" title="T-SQL Tuesday 150 - My first technical job" /><published>2022-05-10T00:00:00+01:00</published><updated>2022-05-10T00:00:00+01:00</updated><id>http://bronowski.it/t-sql-tuesday-150-my-first-technical-job</id><content type="html" xml:base="http://bronowski.it/t-sql-tuesday-150-my-first-technical-job/"><![CDATA[<p><a href="https://sqlstudies.com/2022/05/03/tsql-tuesday-127-invite-your-first-technical-job/" title="T-SQL Tuesday invitation"><img src="/assets/images/t-sql-tuesday-logo.jpg" alt="T-SQL Tuesday Logo" /></a></p>

<p>This month the #TSQL2SDAY invitation comes from Kenneth Fisher (<a href="https://twitter.com/sqlstudent144">twitter</a>). The T-SQL Tuesday is a monthly blogging event that was created by Adam Machanic (<a href="http://dataeducation.com/">blog</a>|<a href="https://twitter.com/AdamMachanic">twitter</a>) and is maintained by Steve Jones (<a href="https://voiceofthedba.wordpress.com/">blog</a>|<a href="https://twitter.com/way0utwest">twitter</a>).
Kenneth Fisher who asks us to write about our first technical job. The invitation is in <a href="https://sqlstudies.com/2022/05/03/tsql-tuesday-127-invite-your-first-technical-job/">this</a> post.</p>

<h2 id="ancient-history">Ancient history</h2>

<p>One summer, after my third year at the uni, I was working on my personal website with “funny pictures and jokes”. It was easy to do all of these static HTML pages manually when it was a small website, but when I started adding more and more content I ran out of time. I needed something more powerful. That was PHP. I could finally re-use my code and generate pages. However, the content was still in static text files. As it grew more and more I started looking into MySQL databases but had no idea how to tackle them. I used Microsoft Access before, but SQL was quite new to me. One day I went with my parents to the shopping mall, but it was a boring place so I went straight to the bookstore. I found a magic book called “PHP and MySQL - creating websites”. That was it, the only problem was it was way to expensive for me. I left the bookstore, my dad was just waiting outside and he smiled seeing me there. He got me the book.
I spent my summer holidays learning about PHP and MySQL, when I got back to uni I had an Oracle course (or curse - don’t remember exactly). </p>

<h2 id="my-first-technical-job">My first technical job</h2>

<p>The next summer, I decided not to come home for the holidays but needed a job to survive there on my own. I found a job posting for a “SQL programmer” at a small (almost) family-run company. Applied, as that felt like something I wanted to do (that’s what I thought at least). They hired three youngsters including me who were supposed to support customers’ MS Dynamics databases. I couldn’t code in anything but PHP, so was tasked with the SQL support on SQL Server. I loved it from the first minute. My experiences with MySQL were good, but the ease of SQL Server 2000 and Query Analyzer convinced me to SQL Server. My original plan was to be there at the gig just for the summer holidays, so I could back to the uni in October, however, it occurred that a person who interviewed me was leaving in September and they needed me to stay longer.I have been there for 18 months, doing SQL stuff every day. In my eyes - a dream job.</p>

<h2 id="second-technical-job">Second technical job</h2>

<p>It was a difficult decision because I loved doing things with SQL, but there was an opportunity to join a big US corporation (I lived in Poland). 
That was a big deal because it was a big company, the team was in the US, and they required English (which I did not use at all in the past 4-5 years). The only thing I did not like about it was the “desktop support” role - I did not like to play with hardware at that time, I wanted to deal with databases, but hey, decided, I will take one step back and see if that helps me to grow professionally. 
Shortly after a big world crisis happened and all the projects we were supposed to work on were paused or cancelled. In the meantime, I started chatting with the only DBA in the office (all other folks were in the US). The urge to come back to the database world was so big and I started asking people if there is any way I could join him and the team. With help of all of them it happened and I became Database Engineer. Working mainly with SQL Server and learning how to do things in Oracle. It wasn’t the “SQL programmer” kind of job, but it was infrastructure. Building servers, migrating databases and all sorts of maintenance. My dream job :) </p>

<h2 id="after-that">After that</h2>

<p>Since then I have always been working with databases, mostly SQL Server. My role names were different in each company, but I was doing the same kind of work. </p>

<p>Thanks,</p>

<p>Mikey</p>]]></content><author><name>Mikey Bronowski</name></author><category term="english" /><category term="community" /><category term="events" /><category term="tsql2sday" /><category term="english" /><category term="community" /><category term="events" /><category term="sqlfamily" /><category term="tsql2sday" /><summary type="html"><![CDATA[This month the #TSQL2SDAY invitation comes from Kenneth Fisher who asks us to write about our first technical job.]]></summary></entry><entry xml:lang="pl"><title type="html">Poznaj chocolatey</title><link href="http://bronowski.it/poznaj-chocolatey/" rel="alternate" type="text/html" title="Poznaj chocolatey" /><published>2022-04-20T00:00:00+01:00</published><updated>2022-04-20T00:00:00+01:00</updated><id>http://bronowski.it/poznaj-chocolatey</id><content type="html" xml:base="http://bronowski.it/poznaj-chocolatey/"><![CDATA[<p><img src="/assets/images/chocolatey.jpeg" alt="Chocolatey" /></p>

<p>Ostatnio kupiłem nowy laptop i zdecydowałem, że zainstaluję na nim oprogramowanie za pomocą skryptów - wszystko po to by uniknąć zbędnego klikania i ściągania rzeczy ręcznie. Słyszałem w przeszłości o Chocolatey, jednak nie miałem okazji go przetestować. Nowy laptop to doskonały pretekst żeby pobawić się czekoladą.</p>

<h1 id="co-to-jest-chocolatey">Co to jest Chocolatey?</h1>
<p>Każdy kogo znam uwielbia czekoladę, więc cokolowiek ma w nazwie “czeko”/”<strong>choco-</strong>” musi zadziałać. Poniżej znajduje się kilka słów ze <a href="https://chocolatey.org/how-chocolatey-works">strony</a> twórców usługi;</p>

<blockquote>
  <p>Chocolatey jest rozwiązaniem do zarządzania oprogramowaniem które daje ci wolność tworzenie prostych pakietów oprogramowania i wdrażania gdziekolwiek używasz środowiska Windows wraz ze znajomą konfiguracją czy narzędziami zarządzania systemem.
Zostało zaprojektowane w taki sposób, by było łatwe w użyciu i dostarczało pakiet poteżnych funkcjonalności, które można skalować w obecnej i przyszłej infrastrukturze. Moc i elastyczność w jednym prostym produkcie - to właśnie Chocolatey.</p>
</blockquote>

<h1 id="instalacja-chocolatey">Instalacja Chocolatey</h1>
<p>Oficjalna instrukcja znajduje się <a href="https://chocolatey.org/install">tutaj</a>, a także jako <a href="https://chocolatey.org/courses/installation/installing">rozszerzony kurs instalacji</a>. Jeśli czas Cię nagli, podążaj za poniższymi krokami:</p>

<div class="language-powershell highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="c"># Uruchom Get-ExecutionPolicy. </span><span class="w">
</span><span class="c"># Jeśli zwrócony wynik to Restricted uruchom Set-ExecutionPolicy AllSigned lub Set-ExecutionPolicy Bypass -Scope Process.</span><span class="w">
</span><span class="n">PS</span><span class="w"> </span><span class="nx">C:\</span><span class="err">&gt;</span><span class="w"> </span><span class="nx">Get-ExecutionPolicy</span><span class="w">
</span><span class="cm">&lt;#
Restricted
#&gt;</span><span class="w">

</span><span class="c"># Bypass - nic nie będzie blokowane, i nie będą wyświetlane ostrzeżenia oraz monity.</span><span class="w">
</span><span class="n">PS</span><span class="w"> </span><span class="nx">C:\</span><span class="err">&gt;</span><span class="w"> </span><span class="nx">Set-ExecutionPolicy</span><span class="w"> </span><span class="nx">Bypass</span><span class="w"> </span><span class="nt">-Scope</span><span class="w"> </span><span class="nx">Process</span><span class="w"> </span><span class="nt">-Force</span><span class="w">

</span><span class="c"># Now run the following command:</span><span class="w">
</span><span class="n">PS</span><span class="w"> </span><span class="nx">C:\</span><span class="err">&gt;</span><span class="w"> </span><span class="p">[</span><span class="n">System.Net.ServicePointManager</span><span class="p">]::</span><span class="nx">SecurityProtocol</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="p">[</span><span class="n">System.Net.ServicePointManager</span><span class="p">]::</span><span class="n">SecurityProtocol</span><span class="w"> </span><span class="o">-bor</span><span class="w"> </span><span class="nx">3072</span><span class="p">;</span><span class="w"> </span><span class="n">iex</span><span class="w"> </span><span class="p">((</span><span class="n">New-Object</span><span class="w"> </span><span class="nx">System.Net.WebClient</span><span class="p">)</span><span class="o">.</span><span class="nf">DownloadString</span><span class="p">(</span><span class="s1">'https://chocolatey.org/install.ps1'</span><span class="p">))</span><span class="w">
</span><span class="cm">&lt;#
Getting latest version of the Chocolatey package for download.
Getting Chocolatey from https://chocolatey.org/api/v2/package/chocolatey/0.10.15.
Downloading 7-Zip commandline tool prior to extraction.
Extracting ...
Installing chocolatey on this machine
...
#&gt;</span><span class="w">


</span><span class="c"># confirm the choco is in the house</span><span class="w">
</span><span class="n">PS</span><span class="w"> </span><span class="nx">C:\</span><span class="err">&gt;</span><span class="w"> </span><span class="nx">choco</span><span class="w"> </span><span class="nt">-v</span><span class="w">
</span><span class="cm">&lt;#
0.10.15
#&gt;</span><span class="w">
</span></code></pre></div></div>

<h1 id="instalacja-pakietów">Instalacja pakietów</h1>

<p>Świetnie, właśnie nabyłeś nowiutkie narzędzie. Co teraz? Jak zdobyć pozostałe aplikacje? 
Jednym ze sposobów jest przeszukanie zasobów <a href="https://chocolatey.org/packages">biblioteki Chocolatey</a> w celu znalezienia konkretnego pakietu.
Można to zrobić także z poziomu konsoli PowerShell:</p>

<div class="language-powershell highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="n">PS</span><span class="w"> </span><span class="nx">C:\</span><span class="err">&gt;</span><span class="w"> </span><span class="nx">choco</span><span class="w"> </span><span class="nx">list</span><span class="w">
</span></code></pre></div></div>

<p>Gdy znajdziesz już pożądany pakiet, instalacja go jest prosta:</p>

<div class="language-powershell highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="c"># To jest przyjkład z mojego skryptu</span><span class="w">
</span><span class="n">PS</span><span class="w"> </span><span class="nx">C:\</span><span class="err">&gt;</span><span class="w"> </span><span class="nx">choco</span><span class="w"> </span><span class="nx">install</span><span class="w"> </span><span class="nx">slack</span><span class="w"> </span><span class="nt">-y</span><span class="w">
</span><span class="n">PS</span><span class="w"> </span><span class="nx">C:\</span><span class="err">&gt;</span><span class="w"> </span><span class="nx">choco</span><span class="w"> </span><span class="nx">install</span><span class="w"> </span><span class="nx">docker-desktop</span><span class="w"> </span><span class="nt">-y</span><span class="w">
</span><span class="n">PS</span><span class="w"> </span><span class="nx">C:\</span><span class="err">&gt;</span><span class="w"> </span><span class="nx">choco</span><span class="w"> </span><span class="nx">install</span><span class="w"> </span><span class="nx">grammarly</span><span class="w"> </span><span class="nt">-y</span><span class="w">
</span><span class="n">PS</span><span class="w"> </span><span class="nx">C:\</span><span class="err">&gt;</span><span class="w"> </span><span class="nx">choco</span><span class="w"> </span><span class="nx">install</span><span class="w"> </span><span class="nx">sql-server-management-studio</span><span class="w"> </span><span class="nt">-y</span><span class="w">
</span><span class="n">PS</span><span class="w"> </span><span class="nx">C:\</span><span class="err">&gt;</span><span class="w"> </span><span class="nx">choco</span><span class="w"> </span><span class="nx">install</span><span class="w"> </span><span class="nx">greenshot</span><span class="w"> </span><span class="nt">-y</span><span class="w">
</span><span class="n">PS</span><span class="w"> </span><span class="nx">C:\</span><span class="err">&gt;</span><span class="w"> </span><span class="nx">choco</span><span class="w"> </span><span class="nx">install</span><span class="w"> </span><span class="nx">opera</span><span class="w"> </span><span class="nt">-y</span><span class="w">
</span><span class="n">PS</span><span class="w"> </span><span class="nx">C:\</span><span class="err">&gt;</span><span class="w"> </span><span class="nx">choco</span><span class="w"> </span><span class="nx">install</span><span class="w"> </span><span class="nx">vscode</span><span class="w"> </span><span class="nt">-y</span><span class="w">
</span><span class="o">...</span><span class="w">
</span><span class="c"># w bibliotece znajdują się także rozszerzenia VS Code</span><span class="w">
</span><span class="n">PS</span><span class="w"> </span><span class="nx">C:\</span><span class="err">&gt;</span><span class="w"> </span><span class="nx">choco</span><span class="w"> </span><span class="nx">install</span><span class="w"> </span><span class="nx">vscode-powershell</span><span class="w"> </span><span class="nt">-y</span><span class="w">
</span><span class="n">PS</span><span class="w"> </span><span class="nx">C:\</span><span class="err">&gt;</span><span class="w"> </span><span class="nx">choco</span><span class="w"> </span><span class="nx">install</span><span class="w"> </span><span class="nx">vscode-gitlens</span><span class="w"> </span><span class="nt">-y</span><span class="w">
</span><span class="n">PS</span><span class="w"> </span><span class="nx">C:\</span><span class="err">&gt;</span><span class="w"> </span><span class="nx">choco</span><span class="w"> </span><span class="nx">install</span><span class="w"> </span><span class="nx">vscode-docker</span><span class="w"> </span><span class="nt">-y</span><span class="w">

</span><span class="c"># aby zobaczyć zainstalowane pakiety ruchom poniższe polecenie (zwróc uwagę na przełącznik **-localonly**)</span><span class="w">
</span><span class="n">PS</span><span class="w"> </span><span class="nx">C:\</span><span class="err">&gt;</span><span class="w"> </span><span class="nx">choco</span><span class="w"> </span><span class="nx">list</span><span class="w"> </span><span class="nt">-localonly</span><span class="w">
</span></code></pre></div></div>

<p>Z pewnością zauważyłeś przełącznik <strong>-y</strong> na końcu każdej linii. Ma on konkretną funkcję:</p>

<div class="language-powershell highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="cm">&lt;#
Pakiet putty.install wymaga uruchomienia pliku 'chocolateyInstall.ps1'.
Uwage: Jeśli nie uruchomisz tego skryptu, process instalacji nie powiedzie się.
Uwaga: Aby potwierdzić instalację automatycznie na przyszłość, użyj przełącznika '-y' lub zmień ustawienie::
choco feature enable -n allowGlobalConfirmation
#&gt;</span><span class="w">
</span></code></pre></div></div>

<h1 id="aktualizacja-pakietów">Aktualizacja pakietów</h1>

<p>Aktualizacja pakietów do nowej wersji, lub samego Chocolatey jest bardzo prosta.</p>

<div class="language-powershell highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="c"># aktualizacja wielu pakietów jednocześnie</span><span class="w">
</span><span class="n">PS</span><span class="w"> </span><span class="nx">C:\</span><span class="err">&gt;</span><span class="w"> </span><span class="nx">choco</span><span class="w"> </span><span class="nx">upgrade</span><span class="w"> </span><span class="nx">greenshot</span><span class="w"> </span><span class="nx">grammarly</span><span class="w"> </span><span class="nt">-y</span><span class="w">
</span><span class="cm">&lt;# One package was already on the latest version
Chocolatey upgraded 1/2 packages. 
 See the log for details (C:\ProgramData\chocolatey\logs\chocolatey.log).
#&gt;</span><span class="w">

</span><span class="c"># aktualizacja Chocolatey</span><span class="w">
</span><span class="n">PS</span><span class="w"> </span><span class="nx">C:\</span><span class="err">&gt;</span><span class="w"> </span><span class="nx">choco</span><span class="w"> </span><span class="nx">upgrade</span><span class="w"> </span><span class="nx">chocolatey</span><span class="w"> </span><span class="nt">-y</span><span class="w">
</span></code></pre></div></div>

<h1 id="usuwanie-pakietów">Usuwanie pakietów</h1>

<p>Aby odinstalować pakiet stosujamy podobny schemat.</p>

<div class="language-powershell highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="c"># dobrze jest mieć zainstalowany pakiet, który chcemy odinstalować</span><span class="w">
</span><span class="n">PS</span><span class="w"> </span><span class="nx">C:\</span><span class="err">&gt;</span><span class="w"> </span><span class="nx">choco</span><span class="w"> </span><span class="nx">uninstall</span><span class="w"> </span><span class="nx">putty.install</span><span class="w">

</span><span class="cm">&lt;# w przeciwnym razie...
Uninstalling the following packages:
putty.install
putty.install is not installed. Cannot uninstall a non-existent package.
...
</span></code></pre></div></div>

<p>po poprawkach (zainstalowaniu pakietu) usunięcie aplikacji wygląda następująco</p>

<div class="language-powershell highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="o">...</span><span class="w">
</span><span class="n">putty.install</span><span class="w"> </span><span class="nx">v0.73</span><span class="w">
 </span><span class="n">Running</span><span class="w"> </span><span class="nx">auto</span><span class="w"> </span><span class="nx">uninstaller...</span><span class="w">
 </span><span class="n">Auto</span><span class="w"> </span><span class="nx">uninstaller</span><span class="w"> </span><span class="nx">has</span><span class="w"> </span><span class="nx">successfully</span><span class="w"> </span><span class="nx">uninstalled</span><span class="w"> </span><span class="nx">putty.install</span><span class="w"> </span><span class="nx">or</span><span class="w"> </span><span class="nx">detected</span><span class="w"> </span><span class="nx">previous</span><span class="w"> </span><span class="nx">uninstall.</span><span class="w">
 </span><span class="n">putty.install</span><span class="w"> </span><span class="nx">has</span><span class="w"> </span><span class="nx">been</span><span class="w"> </span><span class="nx">successfully</span><span class="w"> </span><span class="nx">uninstalled.</span><span class="w">

</span><span class="n">Chocolatey</span><span class="w"> </span><span class="nx">uninstalled</span><span class="w"> </span><span class="nx">1/1</span><span class="w"> </span><span class="nx">packages.</span><span class="w"> 
 </span><span class="n">See</span><span class="w"> </span><span class="nx">the</span><span class="w"> </span><span class="nx">log</span><span class="w"> </span><span class="nx">for</span><span class="w"> </span><span class="nx">details</span><span class="w"> </span><span class="p">(</span><span class="n">C:\ProgramData\chocolatey\logs\chocolatey.log</span><span class="p">)</span><span class="o">.</span><span class="w">
</span><span class="c">#&gt;</span><span class="w">
</span></code></pre></div></div>

<h1 id="some-issues">Some issues</h1>

<p>Since it was my first time with Chocolatey I observed some issues, but so far only two were noticeable enough to make a note. The first one was a missing <strong>-y</strong> switch, which is not a typical issue but stopped me for a while.</p>

<p>The other thing is that Chocolatey sometimes stalls for a long time. Like a really long time. At some point, after waiting 30 minutes I had to kill the choco process and that helped.</p>

<h1 id="więcej-informacji">Więcej informacji</h1>

<p>Szukając informacji na temat Chocolatej znalazłem kilka interesujących stron i materiałów:
<a href="https://gist.github.com/yunga/99d04694e2466e017c5502d7c828d4f4">Lista parametrów z opisami</a> w skróconej wersji.</p>

<p>Post na blogu Kendry Little (<a href="http://sqlworkbooks.com/">blog</a>|<a href="https://twitter.com/Kendra_Little">twitter</a>) o instalacji narzędzi Redgate <a href="https://littlekendra.com/2019/12/02/installing-redgate-sql-toolbelt-with-chocolatey/">o instalacji narzędzi Redgate [en]</a> + plus kilka intetesujacych linków oraz <a href="https://chocolatey.github.io/ChocolateyGUI/about">Chocolatey GUI</a>.</p>

<p>Dziękuję,</p>

<p>Mikey</p>]]></content><author><name>Mikey Bronowski</name></author><category term="polski" /><category term="tools" /><category term="chocolatey" /><category term="polski" /><category term="chocolatey" /><category term="community" /><category term="tools" /><summary type="html"><![CDATA[]]></summary></entry></feed>