<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Rich Benner, Author at SQL Solutions Group</title>
	<atom:link href="https://sqlsolutionsgroup.com/author/rbenner/feed/" rel="self" type="application/rss+xml" />
	<link>https://sqlsolutionsgroup.com/author/rbenner/</link>
	<description></description>
	<lastBuildDate>Tue, 19 May 2026 17:10:22 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.9.4</generator>

<image>
	<url>https://sqlsolutionsgroup.com/wp-content/uploads/2021/01/cropped-SSG_FAVICON0002-32x32.png</url>
	<title>Rich Benner, Author at SQL Solutions Group</title>
	<link>https://sqlsolutionsgroup.com/author/rbenner/</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>Full-Text Index Breaking Change in SQL Server 2025</title>
		<link>https://sqlsolutionsgroup.com/full-text-index-breaking-change/</link>
					<comments>https://sqlsolutionsgroup.com/full-text-index-breaking-change/#comments</comments>
		
		<dc:creator><![CDATA[Rich Benner]]></dc:creator>
		<pubDate>Mon, 25 May 2026 05:00:15 +0000</pubDate>
				<category><![CDATA[SQL]]></category>
		<category><![CDATA[SQL Group]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[SQL Server 2025]]></category>
		<category><![CDATA[#BreakingChanges #SQLServer2025 #SQLServer #SQLTraining #SQLSolutionsGroup]]></category>
		<guid isPermaLink="false">https://sqlsolutionsgroup.com/?p=7615</guid>

					<description><![CDATA[<p>Upgrading to SQL Server 2025 means addressing a full-text index breaking change. We walk you through the steps to do that.</p>
<p>The post <a href="https://sqlsolutionsgroup.com/full-text-index-breaking-change/">Full-Text Index Breaking Change in SQL Server 2025</a> appeared first on <a href="https://sqlsolutionsgroup.com">SQL Solutions Group</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p>This post is not a warning against SQL Server 2025. It <strong>IS</strong> a warning regarding one of the gotchas that can occur with any upgrade. In this case, the full-text index breaking change. SQL 2025 is still an excellent version of SQL Server and one we would generally recommend to clients who are considering an upgrade.</p>



<h3 class="wp-block-heading"><strong>Why use Full-Text Indexes?</strong></h3>



<p>The Full-Text Engine manages full-text indexes. The engine splits your text columns into individual terms and builds an inverted index, mapping each term back to the rows in which it appears. Unlike a standard B-tree index, the structure lives outside the normal index internals and is maintained asynchronously via a background process called a <em>crawl</em>. Effectively, <span style="color: #f25e00;"><strong>each word in your text string ends up indexed</strong></span>, rather than the string as a whole. This makes certain types of searches much more efficient (you need to use search terms like CONTAINS() to utilize full text indexes).</p>



<p>If you have to search strings like this then full-text indexes can be very effective. String searching isn’t great in SQL Server, but this is definitely a tool in your belt if you have a requirement that makes it useful.</p>



<div style="height:28px" aria-hidden="true" class="wp-block-spacer"></div>



<h3 class="wp-block-heading"><strong>Full-Text Indexes in SQL Server 2025</strong></h3>



<p>Microsoft publishes lists of breaking changes (if there are any) as well as deprecated features for each release of SQL Server. The <a href="https://learn.microsoft.com/en-us/sql/database-engine/breaking-changes-to-database-engine-features-in-sql-server-2025?view=sql-server-ver17">2025 edition is no different</a>:</p>



<figure class="wp-block-image .wp-block-image img {  display: block; margin-left: 0; margin-right: auto; } clear: both;"><img fetchpriority="high" decoding="async" width="213" height="436" src="https://sqlsolutionsgroup.com/wp-content/uploads/2026/05/BreakingChanges2.png" alt="A list of breaking changes in SQL Server 2025" class="wp-image-7617" srcset="https://sqlsolutionsgroup.com/wp-content/uploads/2026/05/BreakingChanges2.png 213w, https://sqlsolutionsgroup.com/wp-content/uploads/2026/05/BreakingChanges2-147x300.png 147w" sizes="(max-width: 213px) 100vw, 213px" /></figure>



<p></p>



<p>One of the important changes to make a note of is that, after upgrading, <span style="color: #f25e00;"><strong>your full text indexes will be broken</strong></span> <em><strong>unless</strong></em> we make one of two changes.&nbsp;If you don’t take action, you will begin to see errors like this in your error log:</p>



<p><strong>&nbsp;</strong><strong>2026-01-01 00:00:00.00 spid67s Error &#8216;0x80070002&#8217; occurred during full-text index population for table or indexed view &#8216;[TableName].[SchemaName].[ObjectName]&#8217; (table or indexed view ID &#8216;132456789&#8217;, database ID &#8217;67&#8217;), full-text key value &#8216;1324567890’. Attempt will be made to reindex it. If recently performed in-place upgrade to SQL2025, For help please see </strong><a href="https://aka.ms/sqlfulltext"><strong>https://aka.ms/sqlfulltext</strong></a><strong>.</strong></p>



<p>Why? Microsoft changed the architecture of how full-text indexes are stored behind the scenes. Because this is a significant change, there are now <span style="color: #f25e00;"><strong>two versions of full text searches we can use</strong></span>. To see which one you’re on, you can run the query below:<strong>&nbsp;</strong></p>


<div id="wpshdo_1" class="wp-synhighlighter-outer"><div id="wpshdt_1" class="wp-synhighlighter-expanded"><table border="0" width="100%"><tr><td align="left" width="80%"><a name="#codesyntax_1"></a><a id="wpshat_1" class="wp-synhighlighter-title" href="#codesyntax_1"  onClick="javascript:wpsh_toggleBlock(1)" title="Click to show/hide code block">Source code</a></td><td align="right"><a href="#codesyntax_1" onClick="javascript:wpsh_code(1)" title="Show code only"><img decoding="async" border="0" style="border: 0 none" src="https://sqlsolutionsgroup.com/wp-content/plugins/wp-synhighlight/themes/default/images/code.png" /></a>&nbsp;<a href="#codesyntax_1" onClick="javascript:wpsh_print(1)" title="Print code"><img decoding="async" border="0" style="border: 0 none" src="https://sqlsolutionsgroup.com/wp-content/plugins/wp-synhighlight/themes/default/images/printer.png" /></a>&nbsp;<a href="https://sqlsolutionsgroup.com/wp-content/plugins/wp-synhighlight/About.html" target="_blank" title="Show plugin information"><img decoding="async" border="0" style="border: 0 none" src="https://sqlsolutionsgroup.com/wp-content/plugins/wp-synhighlight/themes/default/images/info.gif" /></a>&nbsp;</td></tr></table></div><div id="wpshdi_1" class="wp-synhighlighter-inner" style="display: block;"><pre class="tsql" style="font-family:monospace;"><span class="kw1">SELECT</span> <span class="sy0">*</span>
<span class="kw1">FROM</span> sys.<span class="me1">database_scoped_configurations</span>
<span class="kw1">WHERE</span> <span class="br0">[</span>name<span class="br0">]</span> <span class="sy0">=</span> <span class="st0">'FULLTEXT_INDEX_VERSION'</span>;</pre></div></div>



<p>If you’re showing version 1, then this is the pre-2025 legacy setting; version 2 is the 2025 and beyond setting.</p>



<div style="height:29px" aria-hidden="true" class="wp-block-spacer"></div>



<h3 class="wp-block-heading"><strong>Legacy Full Text Setting</strong></h3>



<p>The previous version is now marked as legacy and you must explicitly enabled it if you want to continue using it, as follows:</p>


<div id="wpshdo_2" class="wp-synhighlighter-outer"><div id="wpshdt_2" class="wp-synhighlighter-expanded"><table border="0" width="100%"><tr><td align="left" width="80%"><a name="#codesyntax_2"></a><a id="wpshat_2" class="wp-synhighlighter-title" href="#codesyntax_2"  onClick="javascript:wpsh_toggleBlock(2)" title="Click to show/hide code block">Source code</a></td><td align="right"><a href="#codesyntax_2" onClick="javascript:wpsh_code(2)" title="Show code only"><img decoding="async" border="0" style="border: 0 none" src="https://sqlsolutionsgroup.com/wp-content/plugins/wp-synhighlight/themes/default/images/code.png" /></a>&nbsp;<a href="#codesyntax_2" onClick="javascript:wpsh_print(2)" title="Print code"><img decoding="async" border="0" style="border: 0 none" src="https://sqlsolutionsgroup.com/wp-content/plugins/wp-synhighlight/themes/default/images/printer.png" /></a>&nbsp;<a href="https://sqlsolutionsgroup.com/wp-content/plugins/wp-synhighlight/About.html" target="_blank" title="Show plugin information"><img decoding="async" border="0" style="border: 0 none" src="https://sqlsolutionsgroup.com/wp-content/plugins/wp-synhighlight/themes/default/images/info.gif" /></a>&nbsp;</td></tr></table></div><div id="wpshdi_2" class="wp-synhighlighter-inner" style="display: block;"><pre class="tsql" style="font-family:monospace;"><span class="kw1">ALTER</span> <span class="kw1">DATABASE</span> SCOPED CONFIGURATION
<span class="kw1">SET</span> FULLTEXT_<span class="sy0">IN</span>DEX_VERSION <span class="sy0">=</span> <span class="nu0">1</span>;</pre></div></div>



<p>As per <a href="https://learn.microsoft.com/en-us/sql/database-engine/breaking-changes-to-database-engine-features-in-sql-server-2025?view=sql-server-ver17#keep-using-version-1">the documentation</a>, you’ll then need to copy your legacy word breaker and filter binaries from your original instance.</p>



<p>We would only suggest using this legacy option if you have a specific need to use it (e.g. a vendor app requirement or similar), just as we would with other deprecated or legacy features of SQL Server.</p>



<div style="height:26px" aria-hidden="true" class="wp-block-spacer"></div>



<h3 class="wp-block-heading">&nbsp;</h3>



<h3 class="wp-block-heading"><strong>Upgrade Full-Text to 2025</strong></h3>



<p>The more <span style="color: #f25e00;"><strong>future-proof way</strong></span> of ensuring your full text indexes work after an upgrade is to rebuild your catalogs manually. This kicks off a new crawl and upgrades your full-text indexes to work with the more modern version of the engine.</p>


<div id="wpshdo_3" class="wp-synhighlighter-outer"><div id="wpshdt_3" class="wp-synhighlighter-expanded"><table border="0" width="100%"><tr><td align="left" width="80%"><a name="#codesyntax_3"></a><a id="wpshat_3" class="wp-synhighlighter-title" href="#codesyntax_3"  onClick="javascript:wpsh_toggleBlock(3)" title="Click to show/hide code block">Source code</a></td><td align="right"><a href="#codesyntax_3" onClick="javascript:wpsh_code(3)" title="Show code only"><img decoding="async" border="0" style="border: 0 none" src="https://sqlsolutionsgroup.com/wp-content/plugins/wp-synhighlight/themes/default/images/code.png" /></a>&nbsp;<a href="#codesyntax_3" onClick="javascript:wpsh_print(3)" title="Print code"><img decoding="async" border="0" style="border: 0 none" src="https://sqlsolutionsgroup.com/wp-content/plugins/wp-synhighlight/themes/default/images/printer.png" /></a>&nbsp;<a href="https://sqlsolutionsgroup.com/wp-content/plugins/wp-synhighlight/About.html" target="_blank" title="Show plugin information"><img decoding="async" border="0" style="border: 0 none" src="https://sqlsolutionsgroup.com/wp-content/plugins/wp-synhighlight/themes/default/images/info.gif" /></a>&nbsp;</td></tr></table></div><div id="wpshdi_3" class="wp-synhighlighter-inner" style="display: block;"><pre class="tsql" style="font-family:monospace;"><span class="kw1">ALTER</span> FULLTEXT <span class="kw1">CATALOG</span> <span class="br0">[</span>FtCatalog<span class="br0">]</span> REBUILD;</pre></div></div>



<p>The full text crawl will happen behind the scenes. If you want to investigate other issues you may have with full-text indexes, check out our <a href="https://sqlsolutionsgroup.com/fixing-full-text-index/">Fixing Full-Text Indexes</a> blog post.</p>



<p>If you are a control freak (like a lot of us), you can use the script below to check the status of your full-text crawls at a table level for all databases and tables on your server.&nbsp;</p>


<div id="wpshdo_4" class="wp-synhighlighter-outer"><div id="wpshdt_4" class="wp-synhighlighter-expanded"><table border="0" width="100%"><tr><td align="left" width="80%"><a name="#codesyntax_4"></a><a id="wpshat_4" class="wp-synhighlighter-title" href="#codesyntax_4"  onClick="javascript:wpsh_toggleBlock(4)" title="Click to show/hide code block">Source code</a></td><td align="right"><a href="#codesyntax_4" onClick="javascript:wpsh_code(4)" title="Show code only"><img decoding="async" border="0" style="border: 0 none" src="https://sqlsolutionsgroup.com/wp-content/plugins/wp-synhighlight/themes/default/images/code.png" /></a>&nbsp;<a href="#codesyntax_4" onClick="javascript:wpsh_print(4)" title="Print code"><img decoding="async" border="0" style="border: 0 none" src="https://sqlsolutionsgroup.com/wp-content/plugins/wp-synhighlight/themes/default/images/printer.png" /></a>&nbsp;<a href="https://sqlsolutionsgroup.com/wp-content/plugins/wp-synhighlight/About.html" target="_blank" title="Show plugin information"><img decoding="async" border="0" style="border: 0 none" src="https://sqlsolutionsgroup.com/wp-content/plugins/wp-synhighlight/themes/default/images/info.gif" /></a>&nbsp;</td></tr></table></div><div id="wpshdi_4" class="wp-synhighlighter-inner" style="display: block;"><pre class="tsql" style="font-family:monospace;"><span class="kw1">USE</span> master;
GO
<span class="kw1">IF</span> <span class="kw2">OBJECT_ID</span><span class="br0">&#40;</span><span class="st0">'tempdb..#FullTextTables'</span><span class="br0">&#41;</span> <span class="kw1">IS</span> <span class="sy0">NOT</span> <span class="sy0">NULL</span>
<span class="kw1">DROP</span> <span class="kw1">TABLE</span> #FullTextTables;
<span class="kw1">CREATE</span> <span class="kw1">TABLE</span> #FullTextTables
<span class="br0">&#40;</span>
database_name sysname,
schema_name sysname,
table_name sysname,
fulltext_catalog sysname,
is_enabled <span class="kw1">BIT</span>,
change_tracking_state_desc <span class="kw1">NVARCHAR</span><span class="br0">&#40;</span>60<span class="br0">&#41;</span>,
has_crawl_completed <span class="kw1">BIT</span>
<span class="br0">&#41;</span>;
<span class="kw1">DECLARE</span> @db sysname;
<span class="kw1">DECLARE</span> @<span class="kw1">SQL</span> <span class="kw1">NVARCHAR</span><span class="br0">&#40;</span><span class="kw2">MAX</span><span class="br0">&#41;</span>;
<span class="kw1">DECLARE</span> dbs <span class="kw1">CURSOR</span> FAST_F<span class="sy0">OR</span>WARD <span class="kw1">FOR</span>
<span class="kw1">SELECT</span> d.<span class="me1">name</span>
<span class="kw1">FROM</span> sys.<span class="me1">databases</span> <span class="kw1">AS</span> d
<span class="kw1">WHERE</span> d.<span class="me1">state_desc</span> <span class="sy0">=</span> <span class="st0">'ONLINE'</span>
<span class="sy0">AND</span> d.<span class="me1">database_id</span> <span class="sy0">&gt;</span> <span class="nu0">4</span>; <span class="co1">-- skip master, tempdb, model, msdb</span>
<span class="kw1">OPEN</span> dbs;
<span class="kw1">FETCH</span> <span class="kw1">NEXT</span> <span class="kw1">FROM</span> dbs <span class="kw1">INTO</span> @db;
<span class="kw1">WHILE</span> <span class="kw2">@@FETCH_STATUS</span> <span class="sy0">=</span> 0
<span class="kw1">BEGIN</span>
<span class="kw1">SET</span> @<span class="kw1">SQL</span> <span class="sy0">=</span> N<span class="st0">'
BEGIN TRY
USE '</span> <span class="sy0">+</span> <span class="kw2">QUOTENAME</span><span class="br0">&#40;</span>@db<span class="br0">&#41;</span> <span class="sy0">+</span> N<span class="st0">';
INSERT INTO #FullTextTables
(
database_name,
schema_name,
table_name,
fulltext_catalog,
is_enabled,
change_tracking_state_desc,
has_crawl_completed
)
SELECT
DB_NAME() AS database_name,
s.name AS schema_name,
t.name AS table_name,
c.name AS fulltext_catalog,
fi.is_enabled,
fi.change_tracking_state_desc,
fi.has_crawl_completed
FROM sys.fulltext_indexes AS fi
INNER JOIN sys.tables AS t
ON t.object_id = fi.object_id
INNER JOIN sys.schemas AS s
ON s.schema_id = t.schema_id
INNER JOIN sys.fulltext_index_catalog_usages AS ficu
ON ficu.object_id = fi.object_id
INNER JOIN sys.fulltext_catalogs AS c
ON c.fulltext_catalog_id = ficu.fulltext_catalog_id;
END TRY
BEGIN CATCH
-- ignore databases you cannot access
END CATCH;'</span>;
<span class="kw1">EXEC</span> sys.<span class="kw3">SP_EXECUTESQL</span> @<span class="kw1">SQL</span>;
<span class="kw1">FETCH</span> <span class="kw1">NEXT</span> <span class="kw1">FROM</span> dbs <span class="kw1">INTO</span> @db;
<span class="kw1">END</span>
<span class="kw1">CLOSE</span> dbs;
<span class="kw1">DEALLOCATE</span> dbs;
<span class="kw1">DELETE</span> #FullTextTables <span class="kw1">WHERE</span> has_crawl_completed <span class="sy0">=</span> 1
<span class="kw1">SELECT</span>
database_name,
schema_name,
table_name,
fulltext_catalog,
is_enabled,
change_tracking_state_desc,
has_crawl_completed
<span class="kw1">FROM</span> #FullTextTables
<span class="kw1">ORDER</span> <span class="kw1">BY</span> database_name, fulltext_catalog, schema_name, table_name;
<span class="kw1">DROP</span> <span class="kw1">TABLE</span> #FullTextTables</pre></div></div>



<div style="height:21px" aria-hidden="true" class="wp-block-spacer"></div>



<p>&nbsp;</p>



<h3 class="wp-block-heading"><strong>Conclusion</strong></h3>



<p>If you’re concerned about breaking changes like this, we at SSG perform upgrades all the time. We can assist and guide you safely through your next SQL Server upgrade. <a href="https://sqlsolutionsgroup.com/contact-us/">Reach out</a> and we’d be happy to have a chat.</p>



<p>&nbsp;</p>



<p>&nbsp;</p>
<p>The post <a href="https://sqlsolutionsgroup.com/full-text-index-breaking-change/">Full-Text Index Breaking Change in SQL Server 2025</a> appeared first on <a href="https://sqlsolutionsgroup.com">SQL Solutions Group</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://sqlsolutionsgroup.com/full-text-index-breaking-change/feed/</wfw:commentRss>
			<slash:comments>1</slash:comments>
		
		
			</item>
		<item>
		<title>Moving System Databases: A How-To</title>
		<link>https://sqlsolutionsgroup.com/moving-system-databases/</link>
					<comments>https://sqlsolutionsgroup.com/moving-system-databases/#comments</comments>
		
		<dc:creator><![CDATA[Rich Benner]]></dc:creator>
		<pubDate>Mon, 04 May 2026 06:19:46 +0000</pubDate>
				<category><![CDATA[SQL Group]]></category>
		<category><![CDATA[SQL Server]]></category>
		<guid isPermaLink="false">https://sqlsolutionsgroup.com/?p=7482</guid>

					<description><![CDATA[<p>As consultants, we often see system databases existing on the C drive on SQL Servers. There are some issues with this setup, and the biggest is: if one of your system databases grows and fills your C drive, you will likely crash the OS. If that happens, we’re in big trouble. Therefore, moving system databases [&#8230;]</p>
<p>The post <a href="https://sqlsolutionsgroup.com/moving-system-databases/">Moving System Databases: A How-To</a> appeared first on <a href="https://sqlsolutionsgroup.com">SQL Solutions Group</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>As consultants, we often see system databases existing on the C drive on SQL Servers. There are some issues with this setup, and the biggest is: <span style="color: #f25e00;"><strong>if one of your system databases grows and fills your C drive, you will likely crash the OS</strong></span>. If that happens, we’re in big trouble. Therefore, moving system databases becomes a necessary operation at times.</p>
<p>This is such a common issue because the default locations are set to C for these databases and that’s where they end up on fresh installs 99% of the time. Don’t worry! If you’re in this situation you’re not alone.</p>
<p>Not sure? Let’s check if you have this problem:</p>
<p><div id="wpshdo_5" class="wp-synhighlighter-outer"><div id="wpshdt_5" class="wp-synhighlighter-expanded"><table border="0" width="100%"><tr><td align="left" width="80%"><a name="#codesyntax_5"></a><a id="wpshat_5" class="wp-synhighlighter-title" href="#codesyntax_5"  onClick="javascript:wpsh_toggleBlock(5)" title="Click to show/hide code block">Source code</a></td><td align="right"><a href="#codesyntax_5" onClick="javascript:wpsh_code(5)" title="Show code only"><img decoding="async" border="0" style="border: 0 none" src="https://sqlsolutionsgroup.com/wp-content/plugins/wp-synhighlight/themes/default/images/code.png" /></a>&nbsp;<a href="#codesyntax_5" onClick="javascript:wpsh_print(5)" title="Print code"><img decoding="async" border="0" style="border: 0 none" src="https://sqlsolutionsgroup.com/wp-content/plugins/wp-synhighlight/themes/default/images/printer.png" /></a>&nbsp;<a href="https://sqlsolutionsgroup.com/wp-content/plugins/wp-synhighlight/About.html" target="_blank" title="Show plugin information"><img decoding="async" border="0" style="border: 0 none" src="https://sqlsolutionsgroup.com/wp-content/plugins/wp-synhighlight/themes/default/images/info.gif" /></a>&nbsp;</td></tr></table></div><div id="wpshdi_5" class="wp-synhighlighter-inner" style="display: block;"><pre class="tsql" style="font-family:monospace;"><span class="kw1">SELECT</span>
&nbsp;
db.<span class="me1">name</span> <span class="kw1">AS</span> database_name,
&nbsp;
mf.<span class="me1">name</span> <span class="kw1">AS</span> logical_name,
&nbsp;
mf.<span class="me1">physical_name</span> <span class="kw1">AS</span> file_path,
&nbsp;
<span class="kw1">LEFT</span><span class="br0">&#40;</span>mf.<span class="me1">physical_name</span>, 3<span class="br0">&#41;</span> <span class="kw1">AS</span> drive,
&nbsp;
mf.<span class="me1">type_desc</span> <span class="kw1">AS</span> file_type,
&nbsp;
<span class="kw1">CAST</span><span class="br0">&#40;</span>mf.<span class="kw1">SIZE</span> <span class="sy0">*</span> 8.0 <span class="sy0">/</span> 1024 <span class="kw1">AS</span> <span class="kw1">DECIMAL</span><span class="br0">&#40;</span>10,2<span class="br0">&#41;</span><span class="br0">&#41;</span> <span class="kw1">AS</span> size_mb
&nbsp;
<span class="kw1">FROM</span> sys.<span class="me1">master_files</span> mf
&nbsp;
<span class="sy0">JOIN</span> sys.<span class="me1">databases</span> db <span class="kw1">ON</span> db.<span class="me1">database_id</span> <span class="sy0">=</span> mf.<span class="me1">database_id</span>
&nbsp;
<span class="kw1">WHERE</span> db.<span class="me1">database_id</span> <span class="sy0">&lt;=</span> <span class="nu0">4</span> <span class="co1">-- system databases: master, tempdb, model, msdb</span>
&nbsp;
<span class="kw1">ORDER</span> <span class="kw1">BY</span> db.<span class="me1">name</span>, mf.<span class="me1">type_desc</span>;</pre></div></div></p>
<p>&nbsp;</p>
<p>The output will look something like this. As you can see, this server has all system databases on C:</p>
<p><img decoding="async" width="930" height="273" class="wp-image-7593" src="https://sqlsolutionsgroup.com/wp-content/uploads/2026/05/word-image-7482-1-6.png" srcset="https://sqlsolutionsgroup.com/wp-content/uploads/2026/05/word-image-7482-1-6.png 930w, https://sqlsolutionsgroup.com/wp-content/uploads/2026/05/word-image-7482-1-6-300x88.png 300w, https://sqlsolutionsgroup.com/wp-content/uploads/2026/05/word-image-7482-1-6-768x225.png 768w" sizes="(max-width: 930px) 100vw, 930px" /></p>
<p><span style="color: #f25e00;"><strong>So let’s go ahead and fix this.</strong></span></p>
<p>This process can be scary the first handful of times you do it. But don’t worry! As long as we prepare properly we shouldn’t have any problems and it’ll go smooth as butter.</p>
<p>One very important thing to note is that fixing this will require <span style="color: #f25e00;"><strong>turning off the SQL Server instance</strong></span> so none of your databases will be available while we do this. You’ll definitely need to do this during a maintenance window.</p>
<h3><strong>How to fix?</strong></h3>
<p>On my server I have this drive layout. Please note your specific setup.</p>
<p><img decoding="async" width="803" height="168" class="wp-image-7594" src="https://sqlsolutionsgroup.com/wp-content/uploads/2026/05/word-image-7482-2-6.png" srcset="https://sqlsolutionsgroup.com/wp-content/uploads/2026/05/word-image-7482-2-6.png 803w, https://sqlsolutionsgroup.com/wp-content/uploads/2026/05/word-image-7482-2-6-300x63.png 300w, https://sqlsolutionsgroup.com/wp-content/uploads/2026/05/word-image-7482-2-6-768x161.png 768w, https://sqlsolutionsgroup.com/wp-content/uploads/2026/05/word-image-7482-2-6-800x168.png 800w" sizes="(max-width: 803px) 100vw, 803px" /></p>
<p>Our starting recommendation is to have three separate drives for database files:<span style="color: #f25e00;"><strong> A data drive, a log file drive and a drive for tempdb</strong></span>. The last one is important because tempdb is an absolute spaghetti mess internally and deals with all of the stuff on your server that the other databases don’t want to deal with. It tends to be the most busy drive so we want to separate it from our other databases. Otherwise there will be arguments, like a house full of cats.</p>
<p>Considering the layout I have here (in above image), I’m going to move my tempdb files to the X drive, the other .mdf (data) files are going to R and the .ldf (log) files are going to L.</p>
<h3><strong>SQL Account server permissions</strong></h3>
<p>One very important thing is to check the SQL Service account has access to the file locations that we’re moving to. <strong><span style="color: #f25e00;">Note</span></strong>: This is not your account, this is the SQL Account. You can check this in configuration manager or in the services app:</p>
<p><img loading="lazy" decoding="async" width="1045" height="221" class="wp-image-7595" src="https://sqlsolutionsgroup.com/wp-content/uploads/2026/05/word-image-7482-3-6.png" srcset="https://sqlsolutionsgroup.com/wp-content/uploads/2026/05/word-image-7482-3-6.png 1045w, https://sqlsolutionsgroup.com/wp-content/uploads/2026/05/word-image-7482-3-6-300x63.png 300w, https://sqlsolutionsgroup.com/wp-content/uploads/2026/05/word-image-7482-3-6-1024x217.png 1024w, https://sqlsolutionsgroup.com/wp-content/uploads/2026/05/word-image-7482-3-6-768x162.png 768w" sizes="(max-width: 1045px) 100vw, 1045px" /></p>
<p>We want to navigate to the Windows folder and ensure that this account has full control of the folder. It’ll need to read/write and also create new database files.</p>
<p><img loading="lazy" decoding="async" width="362" height="436" class="wp-image-7596" src="https://sqlsolutionsgroup.com/wp-content/uploads/2026/05/word-image-7482-4-6.png" srcset="https://sqlsolutionsgroup.com/wp-content/uploads/2026/05/word-image-7482-4-6.png 362w, https://sqlsolutionsgroup.com/wp-content/uploads/2026/05/word-image-7482-4-6-249x300.png 249w" sizes="(max-width: 362px) 100vw, 362px" /></p>
<p>If you try starting the instance and you haven’t done this, you’ll get errors like this in the log:</p>
<p><img loading="lazy" decoding="async" width="1369" height="73" class="wp-image-7597" src="https://sqlsolutionsgroup.com/wp-content/uploads/2026/05/word-image-7482-5-6.png" srcset="https://sqlsolutionsgroup.com/wp-content/uploads/2026/05/word-image-7482-5-6.png 1369w, https://sqlsolutionsgroup.com/wp-content/uploads/2026/05/word-image-7482-5-6-300x16.png 300w, https://sqlsolutionsgroup.com/wp-content/uploads/2026/05/word-image-7482-5-6-1024x55.png 1024w, https://sqlsolutionsgroup.com/wp-content/uploads/2026/05/word-image-7482-5-6-768x41.png 768w" sizes="(max-width: 1369px) 100vw, 1369px" /></p>
<p><span style="color: #f25e00;"><strong>Skip this step at your peril!</strong></span></p>
<h3><strong>Moving the Master</strong></h3>
<p>The master database is different to all other databases as you can’t move this with an ALTER DATABASE command; it has to be done in SQL Server Configuration Manager.</p>
<p><img loading="lazy" decoding="async" width="519" height="321" class="wp-image-7598" src="https://sqlsolutionsgroup.com/wp-content/uploads/2026/05/word-image-7482-6-6.png" srcset="https://sqlsolutionsgroup.com/wp-content/uploads/2026/05/word-image-7482-6-6.png 519w, https://sqlsolutionsgroup.com/wp-content/uploads/2026/05/word-image-7482-6-6-300x186.png 300w" sizes="(max-width: 519px) 100vw, 519px" /></p>
<p>Once you have the config manager open, navigate to SQL Server Services -&gt; SQL Server -&gt; right click and choose Properties:</p>
<p><img loading="lazy" decoding="async" width="806" height="350" class="wp-image-7599" src="https://sqlsolutionsgroup.com/wp-content/uploads/2026/05/word-image-7482-7-6.png" srcset="https://sqlsolutionsgroup.com/wp-content/uploads/2026/05/word-image-7482-7-6.png 806w, https://sqlsolutionsgroup.com/wp-content/uploads/2026/05/word-image-7482-7-6-300x130.png 300w, https://sqlsolutionsgroup.com/wp-content/uploads/2026/05/word-image-7482-7-6-768x333.png 768w" sizes="(max-width: 806px) 100vw, 806px" /></p>
<p>In here, navigate to our startup parameters. We’ll have at least three options (there may be more), and these are the three we care about for this process:</p>
<ul>
<li>-d: This is the master.mdf (data) file location</li>
<li>-l: This is the master.ldf (log) file location</li>
<li>-e: This is the SQL Server error log output location. We will not be changing this but definitely take a note of this location. If, at the end of this process, the SQL Server refuses to start up, we’ll want to dig into the log files here to find out what’s happening.</li>
</ul>
<p><img loading="lazy" decoding="async" width="418" height="496" class="wp-image-7600" src="https://sqlsolutionsgroup.com/wp-content/uploads/2026/05/word-image-7482-8-6.png" srcset="https://sqlsolutionsgroup.com/wp-content/uploads/2026/05/word-image-7482-8-6.png 418w, https://sqlsolutionsgroup.com/wp-content/uploads/2026/05/word-image-7482-8-6-253x300.png 253w" sizes="(max-width: 418px) 100vw, 418px" /></p>
<p><img loading="lazy" decoding="async" width="412" height="248" class="wp-image-7601" src="https://sqlsolutionsgroup.com/wp-content/uploads/2026/05/word-image-7482-9-6.png" srcset="https://sqlsolutionsgroup.com/wp-content/uploads/2026/05/word-image-7482-9-6.png 412w, https://sqlsolutionsgroup.com/wp-content/uploads/2026/05/word-image-7482-9-6-300x181.png 300w" sizes="(max-width: 412px) 100vw, 412px" /></p>
<p>To tell SQL Server where we want to move master to, you’ll want to change the file locations to your new filepath by highlighting it and changing the file path from within the “Specify a startup parameter” window and hitting Update. Once you’ve done both file locations and they reflect the new locations in the ‘Existing Parameters’ window, we’re golden.</p>
<p>Once you save you’ll get this window:</p>
<p><img loading="lazy" decoding="async" width="406" height="152" class="wp-image-7602" src="https://sqlsolutionsgroup.com/wp-content/uploads/2026/05/word-image-7482-10-6.png" srcset="https://sqlsolutionsgroup.com/wp-content/uploads/2026/05/word-image-7482-10-6.png 406w, https://sqlsolutionsgroup.com/wp-content/uploads/2026/05/word-image-7482-10-6-300x112.png 300w" sizes="(max-width: 406px) 100vw, 406px" /></p>
<p>This is important to understand. We haven’t moved anything yet, <span style="color: #f25e00;"><strong>we’ve just told SQL Server where they will be</strong></span>. Remember, these are startup parameters so that’s when the check will be run for the location.</p>
<h3><strong>Other System Databases: msdb, model, tempdb</strong></h3>
<p>These ones we can do from within SSMS, so let’s take the query below, replace the parameters <strong><span style="color: #f25e00;">with your new filepaths</span></strong>, and hit execute. This won’t do anything other than create the scripts. You’ll have to execute them manually (don’t worry!).</p>
<p><div id="wpshdo_6" class="wp-synhighlighter-outer"><div id="wpshdt_6" class="wp-synhighlighter-expanded"><table border="0" width="100%"><tr><td align="left" width="80%"><a name="#codesyntax_6"></a><a id="wpshat_6" class="wp-synhighlighter-title" href="#codesyntax_6"  onClick="javascript:wpsh_toggleBlock(6)" title="Click to show/hide code block">Source code</a></td><td align="right"><a href="#codesyntax_6" onClick="javascript:wpsh_code(6)" title="Show code only"><img decoding="async" border="0" style="border: 0 none" src="https://sqlsolutionsgroup.com/wp-content/plugins/wp-synhighlight/themes/default/images/code.png" /></a>&nbsp;<a href="#codesyntax_6" onClick="javascript:wpsh_print(6)" title="Print code"><img decoding="async" border="0" style="border: 0 none" src="https://sqlsolutionsgroup.com/wp-content/plugins/wp-synhighlight/themes/default/images/printer.png" /></a>&nbsp;<a href="https://sqlsolutionsgroup.com/wp-content/plugins/wp-synhighlight/About.html" target="_blank" title="Show plugin information"><img decoding="async" border="0" style="border: 0 none" src="https://sqlsolutionsgroup.com/wp-content/plugins/wp-synhighlight/themes/default/images/info.gif" /></a>&nbsp;</td></tr></table></div><div id="wpshdi_6" class="wp-synhighlighter-inner" style="display: block;"><pre class="tsql" style="font-family:monospace;"><span class="kw1">DECLARE</span> @NewDataFilepath <span class="kw1">NVARCHAR</span><span class="br0">&#40;</span><span class="nu0">4000</span><span class="br0">&#41;</span> <span class="sy0">=</span> <span class="st0">'R:<span class="es0">\'</span>
&nbsp;
,@NewLogFilepath nvarchar(4000) = '</span>L:\<span class="st0">'
&nbsp;
,@NewTempdbFilepath nvarchar(4000) = '</span>X:\<span class="st0">'
&nbsp;
SELECT
&nbsp;
db.name AS database_name,
&nbsp;
mf.name AS logical_name,
&nbsp;
mf.physical_name AS file_path,
&nbsp;
mf.type_desc AS file_type,
&nbsp;
CASE WHEN db.name = '</span>tempdb<span class="st0">' THEN '</span><span class="kw1">ALTER</span> <span class="kw1">DATABASE</span> <span class="br0">[</span><span class="st0">' + db.name + '</span><span class="br0">]</span> <span class="kw1">MODIFY</span> <span class="kw1">FILE</span> <span class="br0">&#40;</span>NAME <span class="sy0">=</span> <span class="st0">' + mf.name + '</span>, FILENAME <span class="sy0">=</span> <span class="st0">''</span><span class="st0">' + @NewTempdbFilepath + REVERSE(LEFT(REVERSE(mf.physical_name), CHARINDEX('</span>\<span class="st0">', REVERSE(mf.physical_name)) - 1)) + '</span><span class="st0">''</span> <span class="br0">&#41;</span><span class="st0">'
&nbsp;
WHEN mf.type_desc = '</span><span class="kw1">ROWS</span><span class="st0">' THEN '</span><span class="kw1">ALTER</span> <span class="kw1">DATABASE</span> <span class="br0">[</span><span class="st0">' + db.name + '</span><span class="br0">]</span> <span class="kw1">MODIFY</span> <span class="kw1">FILE</span> <span class="br0">&#40;</span>NAME <span class="sy0">=</span> <span class="st0">' + mf.name + '</span>, FILENAME <span class="sy0">=</span> <span class="st0">''</span><span class="st0">' + @NewDataFilepath + REVERSE(LEFT(REVERSE(mf.physical_name), CHARINDEX('</span>\<span class="st0">', REVERSE(mf.physical_name)) - 1)) + '</span><span class="st0">''</span> <span class="br0">&#41;</span><span class="st0">'
&nbsp;
WHEN mf.type_desc = '</span><span class="kw2">LOG</span><span class="st0">' THEN '</span><span class="kw1">ALTER</span> <span class="kw1">DATABASE</span> <span class="br0">[</span><span class="st0">' + db.name + '</span><span class="br0">]</span> <span class="kw1">MODIFY</span> <span class="kw1">FILE</span> <span class="br0">&#40;</span>NAME <span class="sy0">=</span> <span class="st0">' + mf.name + '</span>, FILENAME <span class="sy0">=</span> <span class="st0">''</span><span class="st0">' + @NewLogFilepath + REVERSE(LEFT(REVERSE(mf.physical_name), CHARINDEX('</span>\<span class="st0">', REVERSE(mf.physical_name)) - 1)) + '</span><span class="st0">''</span> <span class="br0">&#41;</span><span class="st0">'
&nbsp;
END AS AlterDatabaseCommand
&nbsp;
FROM sys.master_files mf
&nbsp;
JOIN sys.databases db ON db.database_id = mf.database_id
&nbsp;
WHERE db.database_id &lt;= 4 -- system databases: master, tempdb, model, msdb
&nbsp;
AND db.name &lt;&gt; '</span>master<span class="st0">'
&nbsp;
ORDER BY db.name, mf.type_desc;</span></pre></div></div></p>
<p>&nbsp;</p>
<p>The output will look something like this:</p>
<p><img loading="lazy" decoding="async" width="1277" height="225" class="wp-image-7603" src="https://sqlsolutionsgroup.com/wp-content/uploads/2026/05/word-image-7482-11-6.png" srcset="https://sqlsolutionsgroup.com/wp-content/uploads/2026/05/word-image-7482-11-6.png 1277w, https://sqlsolutionsgroup.com/wp-content/uploads/2026/05/word-image-7482-11-6-300x53.png 300w, https://sqlsolutionsgroup.com/wp-content/uploads/2026/05/word-image-7482-11-6-1024x180.png 1024w, https://sqlsolutionsgroup.com/wp-content/uploads/2026/05/word-image-7482-11-6-768x135.png 768w" sizes="(max-width: 1277px) 100vw, 1277px" /></p>
<p>The very important part here is to ensure the new file locations match the actual new locations exactly otherwise you’re going to take your server down and not be able to get it back online.</p>
<p>Once you’re sure the locations are correct, copy the AlterDatabaseCommand column into a new query window, check the new filepaths thoroughly again, and then hit execute. You’ll get a message similar to this in the messages result window:</p>
<p><img loading="lazy" decoding="async" width="966" height="170" class="wp-image-7604" src="https://sqlsolutionsgroup.com/wp-content/uploads/2026/05/word-image-7482-12-6.png" srcset="https://sqlsolutionsgroup.com/wp-content/uploads/2026/05/word-image-7482-12-6.png 966w, https://sqlsolutionsgroup.com/wp-content/uploads/2026/05/word-image-7482-12-6-300x53.png 300w, https://sqlsolutionsgroup.com/wp-content/uploads/2026/05/word-image-7482-12-6-768x135.png 768w" sizes="(max-width: 966px) 100vw, 966px" /></p>
<p>Once we’ve done this, we’ve told SQL Server the new file locations for our system databases.</p>
<h3><strong>Stopping the instance and moving files</strong></h3>
<p>Now that we’ve told SQL the new file locations, we need to go ahead and actually move the files. To do that, we’ll need the SQL Server instance to be stopped. Otherwise, the files will be locked (and remember, these are startup parameters)</p>
<p>Head back into configuration manager, find the SQL Server and hit ‘Stop’:</p>
<p><img loading="lazy" decoding="async" width="809" height="351" class="wp-image-7605" src="https://sqlsolutionsgroup.com/wp-content/uploads/2026/05/word-image-7482-13-6.png" srcset="https://sqlsolutionsgroup.com/wp-content/uploads/2026/05/word-image-7482-13-6.png 809w, https://sqlsolutionsgroup.com/wp-content/uploads/2026/05/word-image-7482-13-6-300x130.png 300w, https://sqlsolutionsgroup.com/wp-content/uploads/2026/05/word-image-7482-13-6-768x333.png 768w" sizes="(max-width: 809px) 100vw, 809px" /></p>
<p>You’ll also have to give the go ahead to stop related services:</p>
<p><img loading="lazy" decoding="async" width="369" height="149" class="wp-image-7606" src="https://sqlsolutionsgroup.com/wp-content/uploads/2026/05/word-image-7482-14-6.png" srcset="https://sqlsolutionsgroup.com/wp-content/uploads/2026/05/word-image-7482-14-6.png 369w, https://sqlsolutionsgroup.com/wp-content/uploads/2026/05/word-image-7482-14-6-300x121.png 300w" sizes="(max-width: 369px) 100vw, 369px" /></p>
<h3><strong>Moving the Database Files</strong></h3>
<p>From this point you can actually move all of our database files to the new file locations in Windows. Go ahead and move the master, model and msdb data and log files to the new locations.</p>
<p>You don’t need to move any of the tempdb files. These are created automatically when the SQL instance starts up so the old ones will no longer be used. As a best practice, you should delete your old tempdb files if they still exist in order to reclaim the disk space.</p>
<p>Remember to enable ‘View file name extensions’ in Windows Explorer so you are sure which file you’re moving to which location.</p>
<h3><strong>Starting SQL Server</strong></h3>
<p>At this point we need to restart the service, head back to configuration manager, and start the SQL Server service:</p>
<p><img loading="lazy" decoding="async" width="813" height="469" class="wp-image-7607" src="https://sqlsolutionsgroup.com/wp-content/uploads/2026/05/word-image-7482-15-6.png" srcset="https://sqlsolutionsgroup.com/wp-content/uploads/2026/05/word-image-7482-15-6.png 813w, https://sqlsolutionsgroup.com/wp-content/uploads/2026/05/word-image-7482-15-6-300x173.png 300w, https://sqlsolutionsgroup.com/wp-content/uploads/2026/05/word-image-7482-15-6-768x443.png 768w" sizes="(max-width: 813px) 100vw, 813px" /></p>
<p>Hopefully you’ll see this screen with the services running as planned:</p>
<p><img loading="lazy" decoding="async" width="815" height="275" class="wp-image-7608" src="https://sqlsolutionsgroup.com/wp-content/uploads/2026/05/word-image-7482-16-5.png" srcset="https://sqlsolutionsgroup.com/wp-content/uploads/2026/05/word-image-7482-16-5.png 815w, https://sqlsolutionsgroup.com/wp-content/uploads/2026/05/word-image-7482-16-5-300x101.png 300w, https://sqlsolutionsgroup.com/wp-content/uploads/2026/05/word-image-7482-16-5-768x259.png 768w" sizes="(max-width: 815px) 100vw, 815px" /></p>
<p>Remember to manually start any services (<em><strong><span style="color: #f25e00;">cough</span></strong></em> SQL Server Agent <em><strong><span style="color: #f25e00;">cough</span></strong></em>) that we had to shut down in order to stop the SQL Server service.</p>
<p>As long as they all start you’re golden, you can skip down to the bottom of this article to run our final checks.</p>
<h3><strong>SQL Server Start Failing</strong></h3>
<p>If SQL won’t start, don’t worry, we can fix that!</p>
<p>Go to the log file location from the beginning of this process and open the ERRORLOG file:</p>
<p><img loading="lazy" decoding="async" width="880" height="201" class="wp-image-7609" src="https://sqlsolutionsgroup.com/wp-content/uploads/2026/05/word-image-7482-17-5.png" srcset="https://sqlsolutionsgroup.com/wp-content/uploads/2026/05/word-image-7482-17-5.png 880w, https://sqlsolutionsgroup.com/wp-content/uploads/2026/05/word-image-7482-17-5-300x69.png 300w, https://sqlsolutionsgroup.com/wp-content/uploads/2026/05/word-image-7482-17-5-768x175.png 768w" sizes="(max-width: 880px) 100vw, 880px" /></p>
<p>Open this one (it’s a text file so notepad is fine) and scroll to the bottom. It tells you exactly what the problem is:</p>
<p><img loading="lazy" decoding="async" width="1451" height="170" class="wp-image-7610" src="https://sqlsolutionsgroup.com/wp-content/uploads/2026/05/word-image-7482-18-5.png" srcset="https://sqlsolutionsgroup.com/wp-content/uploads/2026/05/word-image-7482-18-5.png 1451w, https://sqlsolutionsgroup.com/wp-content/uploads/2026/05/word-image-7482-18-5-300x35.png 300w, https://sqlsolutionsgroup.com/wp-content/uploads/2026/05/word-image-7482-18-5-1024x120.png 1024w, https://sqlsolutionsgroup.com/wp-content/uploads/2026/05/word-image-7482-18-5-768x90.png 768w" sizes="(max-width: 1451px) 100vw, 1451px" /></p>
<p>In this instance, there was an access denied error (intentional for this demo, promise 😊) which I fixed by giving permission to the SQL Server service account to those individual files. We don’t have enough space in this blog post to be able to explain every problem you may encounter, but you’re a grown up, you can work it out (or go use your Google fingers furiously like the rest of us).</p>
<h3><strong>Final Checks</strong></h3>
<p>Let’s run our original script to find the locations of our system database files (your query window will ask you to reconnect to the server, this is just because we’ve restarted it).</p>
<p><img loading="lazy" decoding="async" width="891" height="259" class="wp-image-7611" src="https://sqlsolutionsgroup.com/wp-content/uploads/2026/05/word-image-7482-19-5.png" srcset="https://sqlsolutionsgroup.com/wp-content/uploads/2026/05/word-image-7482-19-5.png 891w, https://sqlsolutionsgroup.com/wp-content/uploads/2026/05/word-image-7482-19-5-300x87.png 300w, https://sqlsolutionsgroup.com/wp-content/uploads/2026/05/word-image-7482-19-5-768x223.png 768w" sizes="(max-width: 891px) 100vw, 891px" /></p>
<p>Happy with these file locations? Great! You have a job well done, be proud of yourself!</p>
<p>Now, go tell your boss how good you are at your job and go for a lay down while your heart rate returns to normal.</p>
<p>The post <a href="https://sqlsolutionsgroup.com/moving-system-databases/">Moving System Databases: A How-To</a> appeared first on <a href="https://sqlsolutionsgroup.com">SQL Solutions Group</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://sqlsolutionsgroup.com/moving-system-databases/feed/</wfw:commentRss>
			<slash:comments>1</slash:comments>
		
		
			</item>
		<item>
		<title>Fixing Full-Text Index Issues</title>
		<link>https://sqlsolutionsgroup.com/fixing-full-text-index/</link>
					<comments>https://sqlsolutionsgroup.com/fixing-full-text-index/#respond</comments>
		
		<dc:creator><![CDATA[Rich Benner]]></dc:creator>
		<pubDate>Thu, 05 Feb 2026 17:34:52 +0000</pubDate>
				<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[#Full-TextSearch]]></category>
		<category><![CDATA[#FullTextIndex]]></category>
		<category><![CDATA[#sqldatabase]]></category>
		<category><![CDATA[#SQLPerformance]]></category>
		<guid isPermaLink="false">https://sqlsolutionsgroup.com/?p=7396</guid>

					<description><![CDATA[<p>We’ve had Full-Text index issues come up with surprising frequency lately, so I thought I’d share the fix with all of you lovely people who read this blog. For reference, the customer in this example asked us to look at this problem on a server that is not managed by us.</p>
<p>The post <a href="https://sqlsolutionsgroup.com/fixing-full-text-index/">Fixing Full-Text Index Issues</a> appeared first on <a href="https://sqlsolutionsgroup.com">SQL Solutions Group</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p>We’ve had Full-Text index issues come up with surprising frequency lately. I thought I’d share the fix with all of you lovely people who read this blog. For reference, the customer in this example asked us to look at this problem on a server that is not managed by us.</p>



<h3 class="wp-block-heading">Problem Statement</h3>



<p>The client noticed the D (data) drive was running out of free space and they asked us to investigate. We found that the SQL Logs folder was much larger than we’d expect. A considerable amount of this data was not database files (.mdf, .ldf, .ndf), but rather log files (.log and anything with a .Number file extension):</p>



<figure class="wp-block-image"><img loading="lazy" decoding="async" width="941" height="159" class="wp-image-7397" src="https://sqlsolutionsgroup.com/wp-content/uploads/2026/02/word-image-7396-1.png" alt="" srcset="https://sqlsolutionsgroup.com/wp-content/uploads/2026/02/word-image-7396-1.png 941w, https://sqlsolutionsgroup.com/wp-content/uploads/2026/02/word-image-7396-1-300x51.png 300w, https://sqlsolutionsgroup.com/wp-content/uploads/2026/02/word-image-7396-1-768x130.png 768w" sizes="(max-width: 941px) 100vw, 941px" /></figure>



<p>&nbsp;</p>



<p>Upon further investigation we could see that there were a large number of files starting with SQLFT%. These are full text error files:</p>



<p>&nbsp;</p>



<figure class="wp-block-image"><img decoding="async" class="wp-image-7398" src="https://sqlsolutionsgroup.com/wp-content/uploads/2026/02/word-image-7396-2.png" alt="" /></figure>



<p>&nbsp;</p>



<p>At this point we knew the culprit and had to dig into our full text indexes.</p>



<p>&nbsp;</p>



<h3 class="wp-block-heading">Investigation</h3>



<p><strong>SQL Error Log</strong></p>



<p>If you also check your SQL Error log in SSMS, you will likely see a constant stop and restart of the Full-Text process:</p>



<figure class="wp-block-image"><img loading="lazy" decoding="async" width="776" height="400" class="wp-image-7399" src="https://sqlsolutionsgroup.com/wp-content/uploads/2026/02/word-image-7396-3.png" alt="" srcset="https://sqlsolutionsgroup.com/wp-content/uploads/2026/02/word-image-7396-3.png 776w, https://sqlsolutionsgroup.com/wp-content/uploads/2026/02/word-image-7396-3-300x155.webp 300w, https://sqlsolutionsgroup.com/wp-content/uploads/2026/02/word-image-7396-3-768x396.webp 768w" sizes="(max-width: 776px) 100vw, 776px" /></figure>



<p>&nbsp;</p>



<p>If we want specific details around which table/index is causing issues, we will have to check the Full-Text error log directly.</p>



<p><strong>Reading Your Full-Text Error Log</strong></p>



<p>There’s no GUI way of reading the Full-Text error log in SSMS. To do that, you’ll have to read the file off disk directly. And for that, you’ll need xp_cmdshell enabled, as follows:</p>



<div id="wpshdo_7" class="wp-synhighlighter-outer"><div id="wpshdt_7" class="wp-synhighlighter-expanded"><table border="0" width="100%"><tr><td align="left" width="80%"><a name="#codesyntax_7"></a><a id="wpshat_7" class="wp-synhighlighter-title" href="#codesyntax_7"  onClick="javascript:wpsh_toggleBlock(7)" title="Click to show/hide code block">Source code</a></td><td align="right"><a href="#codesyntax_7" onClick="javascript:wpsh_code(7)" title="Show code only"><img decoding="async" border="0" style="border: 0 none" src="https://sqlsolutionsgroup.com/wp-content/plugins/wp-synhighlight/themes/default/images/code.png" /></a>&nbsp;<a href="#codesyntax_7" onClick="javascript:wpsh_print(7)" title="Print code"><img decoding="async" border="0" style="border: 0 none" src="https://sqlsolutionsgroup.com/wp-content/plugins/wp-synhighlight/themes/default/images/printer.png" /></a>&nbsp;<a href="https://sqlsolutionsgroup.com/wp-content/plugins/wp-synhighlight/About.html" target="_blank" title="Show plugin information"><img decoding="async" border="0" style="border: 0 none" src="https://sqlsolutionsgroup.com/wp-content/plugins/wp-synhighlight/themes/default/images/info.gif" /></a>&nbsp;</td></tr></table></div><div id="wpshdi_7" class="wp-synhighlighter-inner" style="display: block;"><pre class="tsql" style="font-family:monospace;"><span class="kw1">EXEC</span> <span class="kw3">SP_CONFIGURE</span> <span class="st0">'show advanced options'</span>, <span class="nu0">1</span>;
<span class="kw1">RECONFIGURE</span>;
<span class="kw1">EXEC</span> <span class="kw3">SP_CONFIGURE</span> <span class="st0">'xp_cmdshell'</span>, <span class="nu0">1</span>;
<span class="kw1">RECONFIGURE</span>;</pre></div></div>
<p>

</p>
<p>You can then read this file (and any others) using the query below:</p>
<p>

</p>
<div id="wpshdo_8" class="wp-synhighlighter-outer"><div id="wpshdt_8" class="wp-synhighlighter-expanded"><table border="0" width="100%"><tr><td align="left" width="80%"><a name="#codesyntax_8"></a><a id="wpshat_8" class="wp-synhighlighter-title" href="#codesyntax_8"  onClick="javascript:wpsh_toggleBlock(8)" title="Click to show/hide code block">Source code</a></td><td align="right"><a href="#codesyntax_8" onClick="javascript:wpsh_code(8)" title="Show code only"><img decoding="async" border="0" style="border: 0 none" src="https://sqlsolutionsgroup.com/wp-content/plugins/wp-synhighlight/themes/default/images/code.png" /></a>&nbsp;<a href="#codesyntax_8" onClick="javascript:wpsh_print(8)" title="Print code"><img decoding="async" border="0" style="border: 0 none" src="https://sqlsolutionsgroup.com/wp-content/plugins/wp-synhighlight/themes/default/images/printer.png" /></a>&nbsp;<a href="https://sqlsolutionsgroup.com/wp-content/plugins/wp-synhighlight/About.html" target="_blank" title="Show plugin information"><img decoding="async" border="0" style="border: 0 none" src="https://sqlsolutionsgroup.com/wp-content/plugins/wp-synhighlight/themes/default/images/info.gif" /></a>&nbsp;</td></tr></table></div><div id="wpshdi_8" class="wp-synhighlighter-inner" style="display: block;"><pre class="tsql" style="font-family:monospace;"><span class="kw1">EXEC</span> xp_cmdshell <span class="st0">'type &quot;D:<span class="es0">\P</span>rogram Files<span class="es0">\M</span>icrosoft SQL Server<span class="es0">\M</span>SSQL13.MSSQLSERVER<span class="es0">\M</span>SSQL<span class="es0">\L</span>og<span class="es0">\F</span>DLAUNCHERRORLOG&quot;'</span>;</pre></div></div>
<p>

</p>
<p>The potential challenge here is: if you’ve got an issue with Full-Text then this file has the potential to be very large (in this scenario, it was 2.4GB). A file of that size may well make this approach prohibitive.</p>
<p>

</p>
<p><strong>Manually Reading the Error Log</strong></p>
<p>

</p>
<p>You won’t be able to open the FDLAUNCHERRORLOG file directly if it’s in use with SQL Server so in this case you will have to take a copy of the file and read the copy. However, there are file size limitations with tools such as Notepad. You will need to use an application that can deal with these large files (<a href="https://code.visualstudio.com/download">VScode</a>, <a href="https://notepad-plus-plus.org/downloads/">Notepad++</a>, etc.) or something that’s specifically designed to open large text files (<a href="https://apps.microsoft.com/detail/9nblggh4mcm8?hl=en-US&amp;gl=US">Large Text File Viewer</a>, <a href="https://klogg.filimonov.dev/">KLOGG</a>, etc).</p>
<p>

</p>
<p>If you need to copy this text file to a different server, I highly recommend zipping the file first. The files are often multiple GB but because it’s a lot of repeated data, they compress really well. It’ll save you a bunch of time in data transfer over your network.</p>
<p>

</p>
<p><strong>Error Log Output</strong></p>
<p>

</p>
<p>Once you’re able to read the error log, you will see an output like this which gives you the specific table or indexed view which is the issue here:</p>
<p>

</p>
<p>

</p>
<figure class="wp-block-image"><img loading="lazy" decoding="async" width="1652" height="305" class="wp-image-7400" src="https://sqlsolutionsgroup.com/wp-content/uploads/2026/02/word-image-7396-4.png" alt="" srcset="https://sqlsolutionsgroup.com/wp-content/uploads/2026/02/word-image-7396-4.png 1652w, https://sqlsolutionsgroup.com/wp-content/uploads/2026/02/word-image-7396-4-300x55.png 300w, https://sqlsolutionsgroup.com/wp-content/uploads/2026/02/word-image-7396-4-1024x189.png 1024w, https://sqlsolutionsgroup.com/wp-content/uploads/2026/02/word-image-7396-4-768x142.png 768w, https://sqlsolutionsgroup.com/wp-content/uploads/2026/02/word-image-7396-4-1536x284.png 1536w" sizes="(max-width: 1652px) 100vw, 1652px" /></figure>
<p>

</p>
<p>This is where (at least one) of our issues are. It’s worth noting that there may well be more than one object involved here. We’re looking for the largest culprit, but once we that one we may well have others that will require our attention. We’ll deal with that when we come to it, though.</p>
<p>

</p>
<p>&nbsp;</p>
<p>

</p>
<h3 class="wp-block-heading">Remediation</h3>
<p>

</p>
<p><strong>Rebuilding Full-Text Catalogue</strong></p>
<p>

</p>
<p>The first thing we want to do is to rebuild our Full-Text catalogue for the affected database. You can easily do this in SSMS:</p>
<p>

</p>
<p>&nbsp;</p>
<p>

</p>
<figure class="wp-block-image"><img decoding="async" class="wp-image-7401" src="https://sqlsolutionsgroup.com/wp-content/uploads/2026/02/word-image-7396-5.png" alt="" /></figure>
<p>

</p>
<p>A rebuild should fix the issue. But if not, you’ll have to go to the next step.</p>
<p>

</p>
<p class="wp-block-heading"><strong>Rebuilding Indexes</strong></p>
<p>

</p>
<p>Luckily, in our scenario the table involved was small so this wasn’t a concern. However, rebuilding indexes comes with the dual caveats that, in larger environments, it can take a long time to complete a rebuild, and it will also consume resources and may potentially cause blocking. In this scenario, you’ll want to do this out of hours or inside a maintenance window.</p>
<p>

</p>
<p><strong>An important note here</strong>: We’d recommend just rebuilding the clustered index if you have one. By doing this, the system will automatically rebuild all other indexes on the table. You can do this using the GUI:</p>
<p>

</p>
<p>&nbsp;</p>
<p>

</p>
<figure class="wp-block-image"><img decoding="async" class="wp-image-7402" src="https://sqlsolutionsgroup.com/wp-content/uploads/2026/02/word-image-7396-6.png" alt="" /></figure>
<p>

</p>
<p>If you’re more comfortable working with code, then you can perform this manually too:</p>
<p>

</p>
<div id="wpshdo_9" class="wp-synhighlighter-outer"><div id="wpshdt_9" class="wp-synhighlighter-expanded"><table border="0" width="100%"><tr><td align="left" width="80%"><a name="#codesyntax_9"></a><a id="wpshat_9" class="wp-synhighlighter-title" href="#codesyntax_9"  onClick="javascript:wpsh_toggleBlock(9)" title="Click to show/hide code block">Source code</a></td><td align="right"><a href="#codesyntax_9" onClick="javascript:wpsh_code(9)" title="Show code only"><img decoding="async" border="0" style="border: 0 none" src="https://sqlsolutionsgroup.com/wp-content/plugins/wp-synhighlight/themes/default/images/code.png" /></a>&nbsp;<a href="#codesyntax_9" onClick="javascript:wpsh_print(9)" title="Print code"><img decoding="async" border="0" style="border: 0 none" src="https://sqlsolutionsgroup.com/wp-content/plugins/wp-synhighlight/themes/default/images/printer.png" /></a>&nbsp;<a href="https://sqlsolutionsgroup.com/wp-content/plugins/wp-synhighlight/About.html" target="_blank" title="Show plugin information"><img decoding="async" border="0" style="border: 0 none" src="https://sqlsolutionsgroup.com/wp-content/plugins/wp-synhighlight/themes/default/images/info.gif" /></a>&nbsp;</td></tr></table></div><div id="wpshdi_9" class="wp-synhighlighter-inner" style="display: block;"><pre class="tsql" style="font-family:monospace;"><span class="kw1">ALTER</span> <span class="kw1">INDEX</span> <span class="br0">[</span>IndexName<span class="br0">]</span> <span class="kw1">ON</span> <span class="br0">[</span>dbo<span class="br0">]</span>.<span class="br0">[</span>TableName<span class="br0">]</span> REBUILD</pre></div></div>
<p>

</p>
<p>Once this is rebuilt (and assuming it returns without errors), you should be golden. You then want to follow the process below to allow you to cycle the log files.</p>
<p>

</p>
<p class="wp-block-heading"><strong>Cycling your Full-Text Log Files</strong></p>
<p>

</p>
<p>There is an undocumented stored procedure that lets you cycle your Full-Text log files the same way you are (hopefully) cycling your SQL Error Logs:</p>
<p>

</p>
<div id="wpshdo_10" class="wp-synhighlighter-outer"><div id="wpshdt_10" class="wp-synhighlighter-expanded"><table border="0" width="100%"><tr><td align="left" width="80%"><a name="#codesyntax_10"></a><a id="wpshat_10" class="wp-synhighlighter-title" href="#codesyntax_10"  onClick="javascript:wpsh_toggleBlock(10)" title="Click to show/hide code block">Source code</a></td><td align="right"><a href="#codesyntax_10" onClick="javascript:wpsh_code(10)" title="Show code only"><img decoding="async" border="0" style="border: 0 none" src="https://sqlsolutionsgroup.com/wp-content/plugins/wp-synhighlight/themes/default/images/code.png" /></a>&nbsp;<a href="#codesyntax_10" onClick="javascript:wpsh_print(10)" title="Print code"><img decoding="async" border="0" style="border: 0 none" src="https://sqlsolutionsgroup.com/wp-content/plugins/wp-synhighlight/themes/default/images/printer.png" /></a>&nbsp;<a href="https://sqlsolutionsgroup.com/wp-content/plugins/wp-synhighlight/About.html" target="_blank" title="Show plugin information"><img decoding="async" border="0" style="border: 0 none" src="https://sqlsolutionsgroup.com/wp-content/plugins/wp-synhighlight/themes/default/images/info.gif" /></a>&nbsp;</td></tr></table></div><div id="wpshdi_10" class="wp-synhighlighter-inner" style="display: block;"><pre class="tsql" style="font-family:monospace;"><span class="kw1">EXEC</span> sp_fulltext_recycle_crawl_log @ftcat <span class="sy0">=</span> ‘FullText <span class="kw1">CATALOG</span> Name;</pre></div></div>
<p>

</p>
<p>This will deallocate the old log files and create new ones. At this point you’re free to delete or move these log files that are filling the drive to free up the disk space. And don’t worry: If you try to delete a file that’s currently in use by SQL Server (the current log files, for example) you won’t be able to.</p>
<p>

</p>
<p><strong>Cycling your Full-Text master error log</strong></p>
<p>

</p>
<p>There is no way of doing this within SSMS. You can do it with this command:</p>
<p>

</p>
<div id="wpshdo_11" class="wp-synhighlighter-outer"><div id="wpshdt_11" class="wp-synhighlighter-expanded"><table border="0" width="100%"><tr><td align="left" width="80%"><a name="#codesyntax_11"></a><a id="wpshat_11" class="wp-synhighlighter-title" href="#codesyntax_11"  onClick="javascript:wpsh_toggleBlock(11)" title="Click to show/hide code block">Source code</a></td><td align="right"><a href="#codesyntax_11" onClick="javascript:wpsh_code(11)" title="Show code only"><img decoding="async" border="0" style="border: 0 none" src="https://sqlsolutionsgroup.com/wp-content/plugins/wp-synhighlight/themes/default/images/code.png" /></a>&nbsp;<a href="#codesyntax_11" onClick="javascript:wpsh_print(11)" title="Print code"><img decoding="async" border="0" style="border: 0 none" src="https://sqlsolutionsgroup.com/wp-content/plugins/wp-synhighlight/themes/default/images/printer.png" /></a>&nbsp;<a href="https://sqlsolutionsgroup.com/wp-content/plugins/wp-synhighlight/About.html" target="_blank" title="Show plugin information"><img decoding="async" border="0" style="border: 0 none" src="https://sqlsolutionsgroup.com/wp-content/plugins/wp-synhighlight/themes/default/images/info.gif" /></a>&nbsp;</td></tr></table></div><div id="wpshdi_11" class="wp-synhighlighter-inner" style="display: block;"><pre class="php" style="font-family:monospace;"><a href="http://www.php.net/exec"><span class="kw3">EXEC</span></a> sp_fulltext_service <span class="st_h">'cycle_errorlog'</span><span class="sy0">;</span></pre></div></div>
<p>

</p>
<p>This will allow you to cycle out this error log, too, if you need to delete the file to free up space.</p>
<p>

</p>
<p>At this point, we have fixed the full text indexes on this database. We may, however, have issues with multiple databases. If we check the SQL Error log and see new errors appearing, then we haven’t quite fixed the whole problem. We will want to go through this process again (check the logs, rebuild indexes, cycle error log files) until we’ve fixed all our problems.</p>
<p>

</p>
<p class="wp-block-heading"><strong>DBCC CHECKTABLE</strong></p>
<p>

</p>
<p>Once we’ve fixed all the issues with Full-Text search it’s a great idea to perform a DBCC CHECKTABLE on the affected tables to ensure we’re not dealing with a corruption issue. CHECKTABLE is much lighter than a full CHECKDB, but it still does read the entire table  to perform the check. Yes, this is another process that we would want to be careful and <strong>perform outside of working hours if at all possible</strong> if the table we’re dealing with is large in our environment.</p>
<p>

</p>
<div id="wpshdo_12" class="wp-synhighlighter-outer"><div id="wpshdt_12" class="wp-synhighlighter-expanded"><table border="0" width="100%"><tr><td align="left" width="80%"><a name="#codesyntax_12"></a><a id="wpshat_12" class="wp-synhighlighter-title" href="#codesyntax_12"  onClick="javascript:wpsh_toggleBlock(12)" title="Click to show/hide code block">Source code</a></td><td align="right"><a href="#codesyntax_12" onClick="javascript:wpsh_code(12)" title="Show code only"><img decoding="async" border="0" style="border: 0 none" src="https://sqlsolutionsgroup.com/wp-content/plugins/wp-synhighlight/themes/default/images/code.png" /></a>&nbsp;<a href="#codesyntax_12" onClick="javascript:wpsh_print(12)" title="Print code"><img decoding="async" border="0" style="border: 0 none" src="https://sqlsolutionsgroup.com/wp-content/plugins/wp-synhighlight/themes/default/images/printer.png" /></a>&nbsp;<a href="https://sqlsolutionsgroup.com/wp-content/plugins/wp-synhighlight/About.html" target="_blank" title="Show plugin information"><img decoding="async" border="0" style="border: 0 none" src="https://sqlsolutionsgroup.com/wp-content/plugins/wp-synhighlight/themes/default/images/info.gif" /></a>&nbsp;</td></tr></table></div><div id="wpshdi_12" class="wp-synhighlighter-inner" style="display: block;"><pre class="tsql" style="font-family:monospace;"><span class="kw1">USE</span> <span class="br0">[</span>DBName<span class="br0">]</span>
&nbsp;
GO
&nbsp;
<span class="kw1">DBCC</span> CHECKTABLE <span class="br0">&#40;</span>‘TableName’<span class="br0">&#41;</span> <span class="kw1">WITH</span> <span class="kw1">WITH</span> <span class="sy0">ALL</span>_ERR<span class="sy0">OR</span>MSGS, NO_<span class="sy0">IN</span>FOMSGS</pre></div></div>
<p>

</p>
<p>This will return any errors encountered while also avoiding any noise from informational messages.</p>
<p>

</p>
<p>You can see the output in the error log:</p>
<p>

</p>
<p>&nbsp;</p>
<p>

</p>
<figure class="wp-block-image"><img decoding="async" class="wp-image-7403" src="https://sqlsolutionsgroup.com/wp-content/uploads/2026/02/word-image-7396-7.png" alt="" /></figure>
<p>

</p>
<p>&nbsp;</p>
<p>

</p>
<h3 class="wp-block-heading">Final Thoughts</h3>
<p>

</p>
<p>If you discover corruption, review <a href="https://sqlsolutionsgroup.com/blindsided-by-database-corruption/">this post</a> I wrote on the topic. If you don’t, you should be good to go — and give yourself a pat on your back for a job well done!</p>
<p>

</p>
<p>And, if you find you can’t solve a Full-Text index issue yourself, we’re always standing by to assist you.</p>
<p>

</p>
<p>&nbsp;</p>
<p></p><p>The post <a href="https://sqlsolutionsgroup.com/fixing-full-text-index/">Fixing Full-Text Index Issues</a> appeared first on <a href="https://sqlsolutionsgroup.com">SQL Solutions Group</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://sqlsolutionsgroup.com/fixing-full-text-index/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Enhancements to TempDB in SQL Server 2025</title>
		<link>https://sqlsolutionsgroup.com/enhancements-to-tempdb-in-sql-server-2025/</link>
					<comments>https://sqlsolutionsgroup.com/enhancements-to-tempdb-in-sql-server-2025/#respond</comments>
		
		<dc:creator><![CDATA[Rich Benner]]></dc:creator>
		<pubDate>Wed, 14 Jan 2026 10:07:47 +0000</pubDate>
				<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[#sqlserver2025]]></category>
		<category><![CDATA[#tempdb]]></category>
		<guid isPermaLink="false">https://sqlsolutionsgroup.com/?p=7376</guid>

					<description><![CDATA[<p>The latest edition of SQL Server comes with many enhancements, and updates to TempDB in SQL Server 2025 are one of our favourites.</p>
<p>The post <a href="https://sqlsolutionsgroup.com/enhancements-to-tempdb-in-sql-server-2025/">Enhancements to TempDB in SQL Server 2025</a> appeared first on <a href="https://sqlsolutionsgroup.com">SQL Solutions Group</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p>The latest edition of SQL Server comes with plenty of enhancements, and some we are particularly looking forward to. Updates to TempDB in SQL Server 2025 are one of our (&#8230; or my) favourites. We’re not talking a <em>redesign</em> of TempDB but rather some noticeable improvements that the community has been shouting out for. Let’s dig into them.</p>

<h3 class="wp-block-heading"><strong>TempDB Space Governance</strong></h3>



<p>This is the big one. We’re going to do extensive testing on this, but it looks extremely promising. In SQL Server 2025, Resource Governor can now limit how much TempDB space a workload is allowed to use. That means:</p>



<ul class="wp-block-list">
<li>One bad report can’t eat <em>all</em> of TempDB</li>



<li>ETL jobs can’t bully OLTP workloads</li>



<li>You can finally put hard limits on temp space usage</li>
</ul>



<p><strong>Why this matters</strong></p>



<p>You may have run into the issue where TempDB gets filled by somebody running a huge reporting query. This fills the TempDB drive and brings down the production server. Sometimes you can’t help users from being users. This is usually compounded in virtualised environments if you’re using something like the AWS Instance Store when you can’t increase the size of this drive other than increasing your instance size (and cost).</p>



<p>Before 2025, Resource Governor could manage CPU and memory, but TempDB was the Wild West. Now it’s fenced in.</p>



<p>If a workload hits its TempDB limit:</p>



<ul class="wp-block-list">
<li>The request fails</li>



<li>TempDB stays healthy</li>



<li>The rest of the server keeps working</li>
</ul>



<p><strong>Example: Limit TempDB usage for a workload group</strong></p>



<p>Note: There are some <a href="https://learn.microsoft.com/en-us/sql/relational-databases/resource-governor/tempdb-space-resource-governance?view=sql-server-ver17#percent-limit-configuration">requirements</a> for your TempDB configuration:</p>


<div id="wpshdo_13" class="wp-synhighlighter-outer"><div id="wpshdt_13" class="wp-synhighlighter-expanded"><table border="0" width="100%"><tr><td align="left" width="80%"><a name="#codesyntax_13"></a><a id="wpshat_13" class="wp-synhighlighter-title" href="#codesyntax_13"  onClick="javascript:wpsh_toggleBlock(13)" title="Click to show/hide code block">Source code</a></td><td align="right"><a href="#codesyntax_13" onClick="javascript:wpsh_code(13)" title="Show code only"><img decoding="async" border="0" style="border: 0 none" src="https://sqlsolutionsgroup.com/wp-content/plugins/wp-synhighlight/themes/default/images/code.png" /></a>&nbsp;<a href="#codesyntax_13" onClick="javascript:wpsh_print(13)" title="Print code"><img decoding="async" border="0" style="border: 0 none" src="https://sqlsolutionsgroup.com/wp-content/plugins/wp-synhighlight/themes/default/images/printer.png" /></a>&nbsp;<a href="https://sqlsolutionsgroup.com/wp-content/plugins/wp-synhighlight/About.html" target="_blank" title="Show plugin information"><img decoding="async" border="0" style="border: 0 none" src="https://sqlsolutionsgroup.com/wp-content/plugins/wp-synhighlight/themes/default/images/info.gif" /></a>&nbsp;</td></tr></table></div><div id="wpshdi_13" class="wp-synhighlighter-inner" style="display: block;"><pre class="tsql" style="font-family:monospace;"><span class="co1">-- Enable Resource Governor</span>
&nbsp;
<span class="kw1">ALTER</span> RESOURCE GOVERN<span class="sy0">OR</span> <span class="kw1">RECONFIGURE</span>
&nbsp;
GO
&nbsp;
<span class="co1">-- Create a workload group with a TempDB limit of 25%</span>
&nbsp;
<span class="kw1">CREATE</span> W<span class="sy0">OR</span>KLOAD <span class="kw1">GROUP</span> ReportingGroup
&nbsp;
<span class="kw1">WITH</span> <span class="br0">&#40;</span>GROUP_MAX_TEMPDB_DATA_PERCENT <span class="sy0">=</span> 25<span class="br0">&#41;</span>
&nbsp;
GO
&nbsp;
<span class="kw1">ALTER</span> RESOURCE GOVERN<span class="sy0">OR</span> <span class="kw1">RECONFIGURE</span>
&nbsp;
GO</pre></div></div>



<p>By doing this you prevent the new workload group we created for using more than 25% of the TempDB space.</p>



<h3 class="wp-block-heading"><strong>Accelerated Database Recovery (ADR) in TempDB</strong></h3>



<p>ADR has been around for a while in user databases, but the fact that we can now use it on TempDB comes with some promising opportunities, but what <em>is</em> ADR exactly?</p>



<p>ADR is basically SQL Server’s way of cleaning up messes <em>way</em> faster. Instead of doing long painful rollbacks that make you stare at “rolling back transaction…” like it’s judging your life choices, ADR keeps a lightweight version store so SQL Server can undo work almost instantly.</p>



<p>That means cancelled queries don’t hang around forever, crash recovery is dramatically quicker, and the transaction log doesn’t balloon while SQL Server cleans up after a bad decision. Think of ADR as giving SQL Server an “undo” button that actually works.</p>



<p><strong>What changes with ADR on TempDB?</strong></p>



<ul class="wp-block-list">
<li>Cancelled queries clean up <em>fast</em></li>



<li>TempDB log truncates more aggressively</li>



<li>Less waiting around for rollback to finish</li>
</ul>



<p>If you’ve ever cancelled a big query and watched TempDB sit there bloated for minutes… yeah, this helps.</p>



<p><strong>Enabling ADR for TempDB</strong></p>



<p>It’s a simple command to enable ADR for any database:</p>


<div id="wpshdo_14" class="wp-synhighlighter-outer"><div id="wpshdt_14" class="wp-synhighlighter-expanded"><table border="0" width="100%"><tr><td align="left" width="80%"><a name="#codesyntax_14"></a><a id="wpshat_14" class="wp-synhighlighter-title" href="#codesyntax_14"  onClick="javascript:wpsh_toggleBlock(14)" title="Click to show/hide code block">Source code</a></td><td align="right"><a href="#codesyntax_14" onClick="javascript:wpsh_code(14)" title="Show code only"><img decoding="async" border="0" style="border: 0 none" src="https://sqlsolutionsgroup.com/wp-content/plugins/wp-synhighlight/themes/default/images/code.png" /></a>&nbsp;<a href="#codesyntax_14" onClick="javascript:wpsh_print(14)" title="Print code"><img decoding="async" border="0" style="border: 0 none" src="https://sqlsolutionsgroup.com/wp-content/plugins/wp-synhighlight/themes/default/images/printer.png" /></a>&nbsp;<a href="https://sqlsolutionsgroup.com/wp-content/plugins/wp-synhighlight/About.html" target="_blank" title="Show plugin information"><img decoding="async" border="0" style="border: 0 none" src="https://sqlsolutionsgroup.com/wp-content/plugins/wp-synhighlight/themes/default/images/info.gif" /></a>&nbsp;</td></tr></table></div><div id="wpshdi_14" class="wp-synhighlighter-inner" style="display: block;"><pre class="tsql" style="font-family:monospace;"><span class="kw1">ALTER</span> <span class="kw1">DATABASE</span> <span class="br0">[</span>tempdb<span class="br0">]</span>
&nbsp;
<span class="kw1">SET</span> ACCELERATED_DATABASE_RECOVERY <span class="sy0">=</span> <span class="kw1">ON</span>
&nbsp;
GO</pre></div></div>



<p>For tempdb, you’ll have to restart the SQL Service for this to take effect (because tempdb is recreated from scratch when you restart the SQL Service).</p>



<p>You can check whether ADR is enabled for tempdb by looking at sys.databases:</p>


<div id="wpshdo_15" class="wp-synhighlighter-outer"><div id="wpshdt_15" class="wp-synhighlighter-expanded"><table border="0" width="100%"><tr><td align="left" width="80%"><a name="#codesyntax_15"></a><a id="wpshat_15" class="wp-synhighlighter-title" href="#codesyntax_15"  onClick="javascript:wpsh_toggleBlock(15)" title="Click to show/hide code block">Source code</a></td><td align="right"><a href="#codesyntax_15" onClick="javascript:wpsh_code(15)" title="Show code only"><img decoding="async" border="0" style="border: 0 none" src="https://sqlsolutionsgroup.com/wp-content/plugins/wp-synhighlight/themes/default/images/code.png" /></a>&nbsp;<a href="#codesyntax_15" onClick="javascript:wpsh_print(15)" title="Print code"><img decoding="async" border="0" style="border: 0 none" src="https://sqlsolutionsgroup.com/wp-content/plugins/wp-synhighlight/themes/default/images/printer.png" /></a>&nbsp;<a href="https://sqlsolutionsgroup.com/wp-content/plugins/wp-synhighlight/About.html" target="_blank" title="Show plugin information"><img decoding="async" border="0" style="border: 0 none" src="https://sqlsolutionsgroup.com/wp-content/plugins/wp-synhighlight/themes/default/images/info.gif" /></a>&nbsp;</td></tr></table></div><div id="wpshdi_15" class="wp-synhighlighter-inner" style="display: block;"><pre class="tsql" style="font-family:monospace;"><span class="kw1">SELECT</span> name, is_accelerated_database_recovery_on <span class="kw1">FROM</span> sys.<span class="me1">databases</span> <span class="kw1">WHERE</span> name <span class="sy0">=</span> <span class="st0">'tempdb'</span></pre></div></div>



<figure class="wp-block-image"><img loading="lazy" decoding="async" width="295" height="69" class="wp-image-7377" src="https://sqlsolutionsgroup.com/wp-content/uploads/2026/01/word-image-7376-1.png" alt="" /></figure>



<p>&nbsp;</p>



<p><strong>Why you should turn this on</strong></p>



<p>TempDB is famously described as the public toilet of SQL Server, and this setting makes clean up a whole lot easier!</p>



<h3 class="wp-block-heading"><strong>Fewer TempDB Headaches</strong></h3>



<p>SQL Server 2025 also brings a bunch of quieter improvements that indirectly help TempDB:</p>



<ul class="wp-block-list">
<li>Better memory grant feedback → fewer spills</li>



<li>Smarter throttling for runaway queries</li>



<li>Reduced contention under high concurrency</li>
</ul>



<p>None of these are “headline features,” but together they mean:</p>



<ul class="wp-block-list">
<li>Less TempDB churn</li>



<li>Fewer surprises</li>



<li>Smoother performance under load</li>
</ul>



<p>&nbsp;</p>



<h3 class="wp-block-heading"><strong>Final Thoughts</strong></h3>



<p>These are enhancements to TempDB in SQL Server 2025, rather than re-writes of the fundamentals.  Honestly, that’s a good thing. It gives you, as the DBA, extra control over tempdb on your servers and gives an overall better performing system. Definitely test these things in your test environment first though!</p>
<p>The post <a href="https://sqlsolutionsgroup.com/enhancements-to-tempdb-in-sql-server-2025/">Enhancements to TempDB in SQL Server 2025</a> appeared first on <a href="https://sqlsolutionsgroup.com">SQL Solutions Group</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://sqlsolutionsgroup.com/enhancements-to-tempdb-in-sql-server-2025/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>A Bug: Log Shipping in Contained Availability Groups</title>
		<link>https://sqlsolutionsgroup.com/log-shipping-in-contained-availability-groups/</link>
					<comments>https://sqlsolutionsgroup.com/log-shipping-in-contained-availability-groups/#respond</comments>
		
		<dc:creator><![CDATA[Rich Benner]]></dc:creator>
		<pubDate>Mon, 03 Nov 2025 14:23:03 +0000</pubDate>
				<category><![CDATA[SQL Server]]></category>
		<guid isPermaLink="false">https://sqlsolutionsgroup.com/?p=7326</guid>

					<description><![CDATA[<p>We’ve recently come up across a fun little bug with log shipping in contained availability groups. A cursory Google search did not bring up any useful posts for troubleshooting, so here we are. If you’re here for the bug, feel free to scroll to the bottom of this post. For the rest of you, however, [&#8230;]</p>
<p>The post <a href="https://sqlsolutionsgroup.com/log-shipping-in-contained-availability-groups/">A Bug: Log Shipping in Contained Availability Groups</a> appeared first on <a href="https://sqlsolutionsgroup.com">SQL Solutions Group</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>We’ve recently come up across a fun little bug with log shipping in contained availability groups. A cursory Google search did not bring up any useful posts for troubleshooting, so here we are. If you’re here for the bug, feel free to scroll to the bottom of this post. For the rest of you, however, let’s add a little context to this scenario before getting to the meat of the situation.</p>
<h3><strong>What’s an Availability Group?</strong></h3>
<p>In short, Availability Groups (AGs) are a SQL Server feature that enables you to connect multiple servers together (at least two, limits depend upon your edition) so they can share databases. One server runs as the primary node and the others act as secondary nodes. In this example we’re going to assume we’re in a two-node AG with one primary node and one secondary node. We’re also going to assume we have a synchronous AG here.</p>
<p>In this setup, the nodes share the databases and sync with each other.  The primary server holds the primary copy of the database and the secondary server holds a read only copy of the same database. The idea is that if we lose the primary node for whatever reason, the AG will fail over and make the other node the primary node. This <span style="color: #f25e00;"><strong>removes any downtime concerns</strong></span> and allows for things like patching to take place without making the database inaccessible while this happens.</p>
<p>The main issue people have is that while databases are shared between the two servers, we (as DBAs) have to keep all non-databases objects synchronized across both nodes — things like user logins, SQL Agent jobs and server level settings. We can do this with tools like the dbatools powershell modules. But, Microsoft decided that they wanted to <span style="color: #f25e00;"><strong>make this process slightly easier</strong></span> for us.</p>
<h3><strong>How is a contained Availability Group different?</strong></h3>
<p>Contained AGs add a third server category, the Listener. This is what users will usually see and connect to; they won’t connect to the nodes separately. This listener also contains all of the server level objects, so you no longer have to do things like sync your agent jobs and logins across your nodes manually.</p>
<p>There are some things to consider. Such as, agent jobs will only run on the primary node at all times. If you want them to run on the secondary then you will have to install it on the nodes directly and avoid the contained AG.</p>
<h3><strong>The Bug: Transaction Log Shipping</strong></h3>
<p>The reason for this blog post is the bug that was mentioned at the beginning. In this scenario, we have a customer with a contained AG that has log shipping involved.</p>
<p>To quickly summarize: log shipping is the act of taking transaction log backups on a server and restoring them elsewhere to make a read-only copy of the original database. In this scenario, the logs are shipped to a server that processes reporting workloads so that this workload does not happen on the main production servers.</p>
<p>Once we set up transaction log shipping in place, we will have three Agent jobs:</p>
<ul>
<li><span style="color: #f25e00;"><strong>LSBackup_DatabaseName</strong></span>: This will happen on the primary node (or the listener in the case of a contained AG) and performs the transaction log backup.</li>
<li><span style="color: #f25e00;"><strong>LSCopy_DatabaseName</strong></span>: This is installed on the recipient of the log shipped data; in this scenario, the reporting server. This finds all of the log backups that have happened within LSBackup and copies them over to the target server.</li>
<li><strong><span style="color: #f25e00;">LSRestore_DatabaseName</span></strong>: This uses the local log backups and restores them to the local copy of the database.</li>
</ul>
<p>Contained AGs absolutely support transaction log shipping. It works much better as you don’t have to manage the primary/secondary server relationship at all. However, we wouldn’t all be here if it was all butterflies and roses, would we?</p>
<p>When you set up log shipping using the GUI you will need several pieces of information to get to the right place. This includes things like backup paths for shared folders, server names, etc. <strong><span style="color: #f25e00;">Our specific bug is all about the server names</span></strong>.</p>
<p>The problem occurred when, for patching, a planned failover of the AG happened. This caused the LSBackup job to begin failing. This meant that there were no files to copy over, and therefore the reporting database began falling behind with data. With no backups, it also caused the transaction log to increase in size.</p>
<p>The specific error we began getting was this (GUID is a placeholder for an actual GUID):</p>
<p><span style="color: #f25e00;"><strong>Error: Could not retrieve backup settings for primary ID ‘GUID’</strong></span></p>
<p>Which is odd in a contained AG, as technically the primary node never changes (it’s always the listener).</p>
<p>We then see, upon the built-in retry logic, the following error:</p>
<p><span style="color: #f25e00;"><strong>Error: Failed to connect to server “SECONDARY NODE”</strong></span></p>
<p>Which it shouldn’t be trying to do at all.</p>
<p>I scripted out the log shipping configuration and the only server names involved were the listener and the reporting server. I didn&#8217;t see any reference to a specific node, so I went digging.</p>
<p>By looking at the LSBackup agent job, we could see that, for some reason, it had been generated with the server name of the primary node at the point of the log shipping being set up:</p>
<p><img loading="lazy" decoding="async" width="1200" height="386" class="wp-image-7327" src="https://sqlsolutionsgroup.com/wp-content/uploads/2025/10/a-screenshot-of-a-computer-ai-generated-content-m.png" alt="A screenshot of a computer AI-generated content may be incorrect." srcset="https://sqlsolutionsgroup.com/wp-content/uploads/2025/10/a-screenshot-of-a-computer-ai-generated-content-m.png 1200w, https://sqlsolutionsgroup.com/wp-content/uploads/2025/10/a-screenshot-of-a-computer-ai-generated-content-m-300x97.png 300w, https://sqlsolutionsgroup.com/wp-content/uploads/2025/10/a-screenshot-of-a-computer-ai-generated-content-m-1024x329.png 1024w, https://sqlsolutionsgroup.com/wp-content/uploads/2025/10/a-screenshot-of-a-computer-ai-generated-content-m-768x247.png 768w" sizes="(max-width: 1200px) 100vw, 1200px" /></p>
<p><span style="color: #f25e00;"><strong>This was the source of the issue</strong></span>. It was trying to read backup information from a secondary database, which it was unable to do. It was therefore failing on log backups. I have no idea why it would have chosen this server. This is now something we’re going to build into all of our checks moving forward.</p>
<h3>Fixing the Bug</h3>
<p><span style="color: #f25e00;"><strong>The fix is simple</strong></span>: Change this job manually to look at the listener and execute the agent job. It will likely take a lot longer than it usually would as it’s backing up a lot more data than normal. However, once complete, the LSCopy and LSRestore jobs will do their job and get the target database up to date.</p>
<p>Hopefully this helps anybody in a similar situation, feel free to reach out if you have any specific questions at all around any of this. I’d be more than happy to have a chat about log shipping in contained availability groups.</p>
<p>The post <a href="https://sqlsolutionsgroup.com/log-shipping-in-contained-availability-groups/">A Bug: Log Shipping in Contained Availability Groups</a> appeared first on <a href="https://sqlsolutionsgroup.com">SQL Solutions Group</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://sqlsolutionsgroup.com/log-shipping-in-contained-availability-groups/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>An introduction to Memory-Optimized Tables in SQL Server</title>
		<link>https://sqlsolutionsgroup.com/memory-optimized-tables-in-sql-server/</link>
					<comments>https://sqlsolutionsgroup.com/memory-optimized-tables-in-sql-server/#respond</comments>
		
		<dc:creator><![CDATA[Rich Benner]]></dc:creator>
		<pubDate>Mon, 15 Sep 2025 14:51:04 +0000</pubDate>
				<category><![CDATA[SQL Server]]></category>
		<guid isPermaLink="false">https://sqlsolutionsgroup.com/?p=7300</guid>

					<description><![CDATA[<p>Explore in-memory/memory-optimized tables in SQL Server and if you should use this feature in your production environment.</p>
<p>The post <a href="https://sqlsolutionsgroup.com/memory-optimized-tables-in-sql-server/">An introduction to Memory-Optimized Tables in SQL Server</a> appeared first on <a href="https://sqlsolutionsgroup.com">SQL Solutions Group</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>A lot of people have heard of <span style="color: #f25e00;"><strong>in-memory/memory-optimized tables</strong></span> in SQL Server. In our experience, however, not many people are using this feature (which first appeared in SQL Server 2014) in their production environments. This introduction will explain what in-memory tables are and how to use them effectively. This post should help guide your decision about using this feature in your production environment.</p>
<p>For the demos below I’m using the Stack Overflow database, you can go grab a copy <strong><a href="https://www.brentozar.com/archive/2015/10/how-to-download-the-stack-overflow-database-via-bittorrent/">here</a></strong>. It comes in various sizes, and a small one is perfectly acceptable for this test. We’re only going to deal with 100k rows of data. Once we have the database available and attached to a test instance of SQL Server, we have a few things to do.</p>
<h4>Setting Up A Memory-Optimized Table</h4>
<p>First, we’re going to create a filegroup for memory-optimized data. Then, create a file within that filegroup (the location below is for my test machine, yours will likely need to be different). Then, set memory-optimized to snapshot (which is best practice).</p>
<p><div id="wpshdo_16" class="wp-synhighlighter-outer"><div id="wpshdt_16" class="wp-synhighlighter-expanded"><table border="0" width="100%"><tr><td align="left" width="80%"><a name="#codesyntax_16"></a><a id="wpshat_16" class="wp-synhighlighter-title" href="#codesyntax_16"  onClick="javascript:wpsh_toggleBlock(16)" title="Click to show/hide code block">Source code</a></td><td align="right"><a href="#codesyntax_16" onClick="javascript:wpsh_code(16)" title="Show code only"><img decoding="async" border="0" style="border: 0 none" src="https://sqlsolutionsgroup.com/wp-content/plugins/wp-synhighlight/themes/default/images/code.png" /></a>&nbsp;<a href="#codesyntax_16" onClick="javascript:wpsh_print(16)" title="Print code"><img decoding="async" border="0" style="border: 0 none" src="https://sqlsolutionsgroup.com/wp-content/plugins/wp-synhighlight/themes/default/images/printer.png" /></a>&nbsp;<a href="https://sqlsolutionsgroup.com/wp-content/plugins/wp-synhighlight/About.html" target="_blank" title="Show plugin information"><img decoding="async" border="0" style="border: 0 none" src="https://sqlsolutionsgroup.com/wp-content/plugins/wp-synhighlight/themes/default/images/info.gif" /></a>&nbsp;</td></tr></table></div><div id="wpshdi_16" class="wp-synhighlighter-inner" style="display: block;"><pre class="tsql" style="font-family:monospace;"><span class="kw1">USE</span> <span class="br0">[</span>StackOverflow<span class="br0">]</span>;
&nbsp;
GO
&nbsp;
<span class="kw1">ALTER</span> <span class="kw1">DATABASE</span> <span class="br0">[</span>StackOverflow<span class="br0">]</span>
&nbsp;
<span class="kw1">ADD</span> FILEGROUP <span class="br0">[</span>StackOverflow_mod_fg<span class="br0">]</span> <span class="kw1">CONTAINS</span> MEM<span class="sy0">OR</span>Y_OPTIMIZED_DATA;
&nbsp;
GO
&nbsp;
<span class="kw1">ALTER</span> <span class="kw1">DATABASE</span> <span class="br0">[</span>StackOverflow<span class="br0">]</span>
&nbsp;
<span class="kw1">ADD</span> <span class="kw1">FILE</span> <span class="br0">&#40;</span>NAME <span class="sy0">=</span> N<span class="st0">'StackOverflow_mod'</span>, FILENAME <span class="sy0">=</span> N<span class="st0">'C:<span class="es0">\P</span>rogram Files<span class="es0">\M</span>icrosoft SQL Server<span class="es0">\M</span>SSQL15.SQL2019<span class="es0">\M</span>SSQL<span class="es0">\D</span>ATA<span class="es0">\S</span>tackOverflow_mod'</span><span class="br0">&#41;</span>
&nbsp;
<span class="kw1">TO</span> FILEGROUP <span class="br0">[</span>StackOverflow_mod_fg<span class="br0">]</span>;
&nbsp;
GO
&nbsp;
<span class="kw1">ALTER</span> <span class="kw1">DATABASE</span> <span class="br0">[</span>StackOverflow<span class="br0">]</span> <span class="kw1">SET</span> MEM<span class="sy0">OR</span>Y_OPTIMIZED_ELEVATE_TO_SNAPSHOT <span class="sy0">=</span> <span class="kw1">ON</span>;
&nbsp;
GO
&nbsp;
<span class="kw1">NEXT</span> we’re going <span class="kw1">TO</span> make a standard <span class="kw1">ON</span> <span class="kw1">DISK</span> <span class="kw1">TABLE</span> so we can <span class="kw1">USE</span> it <span class="kw1">FOR</span> comparison purposes vs the in memory <span class="kw1">TABLE</span> we’re going <span class="kw1">TO</span> <span class="kw1">CREATE</span>.
&nbsp;
<span class="kw1">IF</span> <span class="kw2">OBJECT_ID</span><span class="br0">&#40;</span><span class="st0">'dbo.Posts_Disk'</span><span class="br0">&#41;</span> <span class="kw1">IS</span> <span class="sy0">NOT</span> <span class="sy0">NULL</span> <span class="kw1">DROP</span> <span class="kw1">TABLE</span> dbo.<span class="me1">Posts_Disk</span>;
&nbsp;
GO
&nbsp;
<span class="kw1">SELECT</span> <span class="kw1">TOP</span> <span class="br0">&#40;</span><span class="nu0">100000</span><span class="br0">&#41;</span> <span class="co1">-- keep this modest; raise as your RAM allows</span>
&nbsp;
p.<span class="me1">Id</span>,
&nbsp;
p.<span class="me1">CreationDate</span>,
&nbsp;
p.<span class="me1">Score</span>,
&nbsp;
p.<span class="me1">OwnerUserId</span>,
&nbsp;
p.<span class="me1">PostTypeId</span>,
&nbsp;
p.<span class="me1">Title</span>
&nbsp;
<span class="kw1">INTO</span> dbo.<span class="me1">Posts_Disk</span>
&nbsp;
<span class="kw1">FROM</span> dbo.<span class="me1">Posts</span> <span class="kw1">AS</span> p
&nbsp;
<span class="kw1">WHERE</span> p.<span class="me1">PostTypeId</span> <span class="sy0">IN</span> <span class="br0">&#40;</span><span class="nu0">1</span>,<span class="nu0">2</span><span class="br0">&#41;</span> <span class="co1">-- questions &amp; answers, typical subset</span>
&nbsp;
<span class="kw1">ORDER</span> <span class="kw1">BY</span> p.<span class="me1">Id</span>;
&nbsp;
GO
&nbsp;
<span class="kw1">CREATE</span> <span class="kw1">CLUSTERED</span> <span class="kw1">INDEX</span> CX_Posts_Disk_Id <span class="kw1">ON</span> dbo.<span class="me1">Posts_Disk</span><span class="br0">&#40;</span>Id<span class="br0">&#41;</span>;
&nbsp;
<span class="kw1">CREATE</span> <span class="kw1">INDEX</span> IX_Posts_Disk_CreationDate <span class="kw1">ON</span> dbo.<span class="me1">Posts_Disk</span><span class="br0">&#40;</span>CreationDate<span class="br0">&#41;</span>;
&nbsp;
GO</pre></div></div></p>
<p>Now we’ll make an in memory version of this table.</p>
<p><div id="wpshdo_17" class="wp-synhighlighter-outer"><div id="wpshdt_17" class="wp-synhighlighter-expanded"><table border="0" width="100%"><tr><td align="left" width="80%"><a name="#codesyntax_17"></a><a id="wpshat_17" class="wp-synhighlighter-title" href="#codesyntax_17"  onClick="javascript:wpsh_toggleBlock(17)" title="Click to show/hide code block">Source code</a></td><td align="right"><a href="#codesyntax_17" onClick="javascript:wpsh_code(17)" title="Show code only"><img decoding="async" border="0" style="border: 0 none" src="https://sqlsolutionsgroup.com/wp-content/plugins/wp-synhighlight/themes/default/images/code.png" /></a>&nbsp;<a href="#codesyntax_17" onClick="javascript:wpsh_print(17)" title="Print code"><img decoding="async" border="0" style="border: 0 none" src="https://sqlsolutionsgroup.com/wp-content/plugins/wp-synhighlight/themes/default/images/printer.png" /></a>&nbsp;<a href="https://sqlsolutionsgroup.com/wp-content/plugins/wp-synhighlight/About.html" target="_blank" title="Show plugin information"><img decoding="async" border="0" style="border: 0 none" src="https://sqlsolutionsgroup.com/wp-content/plugins/wp-synhighlight/themes/default/images/info.gif" /></a>&nbsp;</td></tr></table></div><div id="wpshdi_17" class="wp-synhighlighter-inner" style="display: block;"><pre class="tsql" style="font-family:monospace;"><span class="kw1">IF</span> <span class="kw2">OBJECT_ID</span><span class="br0">&#40;</span><span class="st0">'dbo.Posts_InMem'</span><span class="br0">&#41;</span> <span class="kw1">IS</span> <span class="sy0">NOT</span> <span class="sy0">NULL</span> <span class="kw1">DROP</span> <span class="kw1">TABLE</span> dbo.<span class="me1">Posts_InMem</span>;
&nbsp;
GO
&nbsp;
<span class="kw1">CREATE</span> <span class="kw1">TABLE</span> dbo.<span class="me1">Posts_InMem</span>
&nbsp;
<span class="br0">&#40;</span>
&nbsp;
Id <span class="kw1">INT</span> <span class="sy0">NOT</span> <span class="sy0">NULL</span> <span class="kw1">PRIMARY</span> <span class="kw1">KEY</span> <span class="kw1">NONCLUSTERED</span> HASH <span class="kw1">WITH</span> <span class="br0">&#40;</span>BUCKET_COUNT <span class="sy0">=</span> 1048576<span class="br0">&#41;</span>,
&nbsp;
CreationDate DATETIME2 <span class="sy0">NOT</span> <span class="sy0">NULL</span> <span class="kw1">INDEX</span> IX_InMem_CreationDate <span class="kw1">NONCLUSTERED</span>,
&nbsp;
Score <span class="kw1">INT</span> <span class="sy0">NOT</span> <span class="sy0">NULL</span>,
&nbsp;
OwnerUserId <span class="kw1">INT</span> <span class="sy0">NULL</span>,
&nbsp;
PostTypeId <span class="kw1">INT</span> <span class="sy0">NOT</span> <span class="sy0">NULL</span>,
&nbsp;
Title <span class="kw1">NVARCHAR</span><span class="br0">&#40;</span>250<span class="br0">&#41;</span> <span class="sy0">NULL</span>
&nbsp;
<span class="br0">&#41;</span>
&nbsp;
<span class="kw1">WITH</span> <span class="br0">&#40;</span>MEM<span class="sy0">OR</span>Y_OPTIMIZED <span class="sy0">=</span> <span class="kw1">ON</span>, DURABILITY <span class="sy0">=</span> SCHEMA_<span class="sy0">AND</span>_DATA<span class="br0">&#41;</span>;
&nbsp;
GO
&nbsp;
And we’re going <span class="kw1">TO</span> take the same <span class="kw1">DATA</span> <span class="kw1">FROM</span> our <span class="kw1">ON</span> <span class="kw1">DISK</span> <span class="kw1">TABLE</span> and <span class="kw1">INSERT</span> <span class="kw1">INTO</span> our <span class="kw1">NEW</span> in<span class="sy0">-</span>memory <span class="kw1">TABLE</span>;
&nbsp;
<span class="kw1">INSERT</span> dbo.<span class="me1">Posts_InMem</span> <span class="br0">&#40;</span>Id, CreationDate, Score, OwnerUserId, PostTypeId, Title<span class="br0">&#41;</span>
&nbsp;
<span class="kw1">SELECT</span> Id, CreationDate, Score, OwnerUserId, PostTypeId, Title
&nbsp;
<span class="kw1">FROM</span> dbo.<span class="me1">Posts_Disk</span>
&nbsp;
GO</pre></div></div></p>
<p>Let’s do a comparison between our on disk table and our in-memory table. The first comparison we’ll do is to return one record from each table and check the statistics. I wanted an Id that’s roughly in the middle of my tables so that it would be a meaningful comparison. Id 88,011 appears on row 50,000 of my table so I’m using that in the queries below. <strong><span style="color: #f25e00;">This may be different in your version of the database.</span></strong></p>
<p><div id="wpshdo_18" class="wp-synhighlighter-outer"><div id="wpshdt_18" class="wp-synhighlighter-expanded"><table border="0" width="100%"><tr><td align="left" width="80%"><a name="#codesyntax_18"></a><a id="wpshat_18" class="wp-synhighlighter-title" href="#codesyntax_18"  onClick="javascript:wpsh_toggleBlock(18)" title="Click to show/hide code block">Source code</a></td><td align="right"><a href="#codesyntax_18" onClick="javascript:wpsh_code(18)" title="Show code only"><img decoding="async" border="0" style="border: 0 none" src="https://sqlsolutionsgroup.com/wp-content/plugins/wp-synhighlight/themes/default/images/code.png" /></a>&nbsp;<a href="#codesyntax_18" onClick="javascript:wpsh_print(18)" title="Print code"><img decoding="async" border="0" style="border: 0 none" src="https://sqlsolutionsgroup.com/wp-content/plugins/wp-synhighlight/themes/default/images/printer.png" /></a>&nbsp;<a href="https://sqlsolutionsgroup.com/wp-content/plugins/wp-synhighlight/About.html" target="_blank" title="Show plugin information"><img decoding="async" border="0" style="border: 0 none" src="https://sqlsolutionsgroup.com/wp-content/plugins/wp-synhighlight/themes/default/images/info.gif" /></a>&nbsp;</td></tr></table></div><div id="wpshdi_18" class="wp-synhighlighter-inner" style="display: block;"><pre class="tsql" style="font-family:monospace;"><span class="kw1">SET</span> <span class="kw1">STATISTICS</span> <span class="kw1">TIME</span>,IO <span class="kw1">ON</span>;
&nbsp;
<span class="kw1">SELECT</span> <span class="sy0">*</span> <span class="kw1">FROM</span> dbo.<span class="me1">Posts_Disk</span> <span class="kw1">WHERE</span> Id <span class="sy0">=</span> <span class="nu0">88011</span>;
&nbsp;
<span class="kw1">SELECT</span> <span class="sy0">*</span> <span class="kw1">FROM</span> dbo.<span class="me1">Posts_InMem</span> <span class="kw1">WHERE</span> Id <span class="sy0">=</span> <span class="nu0">88011</span>;</pre></div></div></p>
<p>If we copy the statistics from the messages tab output in SSMS and paste into statisticsparser.com (to make it readable), you’ll notice we perform 3 logical page reads on the Posts_Disk table, but zero reads on Posts_InMem.</p>
<p><img loading="lazy" decoding="async" width="942" height="282" class="wp-image-7301" src="https://sqlsolutionsgroup.com/wp-content/uploads/2025/09/word-image-7300-1.png" srcset="https://sqlsolutionsgroup.com/wp-content/uploads/2025/09/word-image-7300-1.png 942w, https://sqlsolutionsgroup.com/wp-content/uploads/2025/09/word-image-7300-1-300x90.png 300w, https://sqlsolutionsgroup.com/wp-content/uploads/2025/09/word-image-7300-1-768x230.png 768w" sizes="(max-width: 942px) 100vw, 942px" /></p>
<p>Now, let’s do a date range comparison. For the parameters used below, I have taken the values from row 30,000 and 70,000 as my two dates so we return a decent amount of the sample data.</p>
<p><div id="wpshdo_19" class="wp-synhighlighter-outer"><div id="wpshdt_19" class="wp-synhighlighter-expanded"><table border="0" width="100%"><tr><td align="left" width="80%"><a name="#codesyntax_19"></a><a id="wpshat_19" class="wp-synhighlighter-title" href="#codesyntax_19"  onClick="javascript:wpsh_toggleBlock(19)" title="Click to show/hide code block">Source code</a></td><td align="right"><a href="#codesyntax_19" onClick="javascript:wpsh_code(19)" title="Show code only"><img decoding="async" border="0" style="border: 0 none" src="https://sqlsolutionsgroup.com/wp-content/plugins/wp-synhighlight/themes/default/images/code.png" /></a>&nbsp;<a href="#codesyntax_19" onClick="javascript:wpsh_print(19)" title="Print code"><img decoding="async" border="0" style="border: 0 none" src="https://sqlsolutionsgroup.com/wp-content/plugins/wp-synhighlight/themes/default/images/printer.png" /></a>&nbsp;<a href="https://sqlsolutionsgroup.com/wp-content/plugins/wp-synhighlight/About.html" target="_blank" title="Show plugin information"><img decoding="async" border="0" style="border: 0 none" src="https://sqlsolutionsgroup.com/wp-content/plugins/wp-synhighlight/themes/default/images/info.gif" /></a>&nbsp;</td></tr></table></div><div id="wpshdi_19" class="wp-synhighlighter-inner" style="display: block;"><pre class="tsql" style="font-family:monospace;"><span class="kw1">SET</span> <span class="kw1">STATISTICS</span> <span class="kw1">TIME</span>,IO <span class="kw1">ON</span>;
&nbsp;
<span class="kw1">DECLARE</span> @d1 DATETIME2 <span class="sy0">=</span> <span class="st0">'2008-09-08 23:48:24.2570000'</span>;
&nbsp;
<span class="kw1">DECLARE</span> @d2 DATETIME2 <span class="sy0">=</span> <span class="st0">'2008-09-22 22:38:47.5570000'</span>;
&nbsp;
<span class="kw1">SELECT</span> <span class="kw2">COUNT</span><span class="br0">&#40;</span><span class="sy0">*</span><span class="br0">&#41;</span>
&nbsp;
<span class="kw1">FROM</span> dbo.<span class="me1">Posts_Disk</span>
&nbsp;
<span class="kw1">WHERE</span> CreationDate <span class="sy0">&gt;=</span> @d1 <span class="sy0">AND</span> CreationDate <span class="sy0">&lt;</span> @d2;
&nbsp;
<span class="kw1">SELECT</span> <span class="kw2">COUNT</span><span class="br0">&#40;</span><span class="sy0">*</span><span class="br0">&#41;</span>
&nbsp;
<span class="kw1">FROM</span> dbo.<span class="me1">Posts_InMem</span>
&nbsp;
<span class="kw1">WHERE</span> CreationDate <span class="sy0">&gt;=</span> @d1 <span class="sy0">AND</span> CreationDate <span class="sy0">&lt;</span> @d2;
&nbsp;
GO</pre></div></div></p>
<p>If we put the stats into statisticsparser.com again, you’ll see that on the Posts_Disk table we have 96 logical reads and an execution time of 38ms.</p>
<p><img loading="lazy" decoding="async" width="937" height="252" class="wp-image-7302" src="https://sqlsolutionsgroup.com/wp-content/uploads/2025/09/a-screenshot-of-a-computer-ai-generated-content-m.png" alt="A screenshot of a computer AI-generated content may be incorrect." srcset="https://sqlsolutionsgroup.com/wp-content/uploads/2025/09/a-screenshot-of-a-computer-ai-generated-content-m.png 937w, https://sqlsolutionsgroup.com/wp-content/uploads/2025/09/a-screenshot-of-a-computer-ai-generated-content-m-300x81.png 300w, https://sqlsolutionsgroup.com/wp-content/uploads/2025/09/a-screenshot-of-a-computer-ai-generated-content-m-768x207.png 768w" sizes="(max-width: 937px) 100vw, 937px" /></p>
<p>And for our in-memory table we show zero logical reads and an execution time of 9ms.</p>
<p><img loading="lazy" decoding="async" width="948" height="280" class="wp-image-7303" src="https://sqlsolutionsgroup.com/wp-content/uploads/2025/09/a-screenshot-of-a-computer-ai-generated-content-m-1.png" alt="A screenshot of a computer AI-generated content may be incorrect." srcset="https://sqlsolutionsgroup.com/wp-content/uploads/2025/09/a-screenshot-of-a-computer-ai-generated-content-m-1.png 948w, https://sqlsolutionsgroup.com/wp-content/uploads/2025/09/a-screenshot-of-a-computer-ai-generated-content-m-1-300x89.png 300w, https://sqlsolutionsgroup.com/wp-content/uploads/2025/09/a-screenshot-of-a-computer-ai-generated-content-m-1-768x227.png 768w" sizes="(max-width: 948px) 100vw, 948px" /></p>
<p>Things get interesting when we compare execution plans.</p>
<p><img loading="lazy" decoding="async" width="1307" height="543" class="wp-image-7304" src="https://sqlsolutionsgroup.com/wp-content/uploads/2025/09/a-computer-screen-shot-of-a-computer-ai-generated.png" alt="A computer screen shot of a computer AI-generated content may be incorrect." srcset="https://sqlsolutionsgroup.com/wp-content/uploads/2025/09/a-computer-screen-shot-of-a-computer-ai-generated.png 1307w, https://sqlsolutionsgroup.com/wp-content/uploads/2025/09/a-computer-screen-shot-of-a-computer-ai-generated-300x125.png 300w, https://sqlsolutionsgroup.com/wp-content/uploads/2025/09/a-computer-screen-shot-of-a-computer-ai-generated-1024x425.png 1024w, https://sqlsolutionsgroup.com/wp-content/uploads/2025/09/a-computer-screen-shot-of-a-computer-ai-generated-768x319.png 768w" sizes="(max-width: 1307px) 100vw, 1307px" /></p>
<p>The query plan at the top is a lot more complicated. It shows the worktables that are being created behind the scenes, but it reports only 15% of the overall estimated query cost. In contrast, the query below is showing as more expensive but from the statistics we can prove that it <strong><span style="color: #f25e00;">produces its results much quicker than the on-disk table</span></strong>. This gives us caution when comparing execution plans as they <strong>can have bad estimates and provide misleading data</strong>.</p>
<h4>What Have We Found?</h4>
<p>From all this, we’ve proven that <strong>in-memory tables can perform much better than classic on-disk tables</strong>. <em><strong>However</strong></em>, that’s not saying there aren’t significant considerations to evaluate when it comes to using these tables. The list below is far from exhaustive, but rather what we consider the most restrictive or problematic points to consider.</p>
<h4>Architectural Issues</h4>
<ul>
<li>All data must fit into memory.</li>
<li>Very large tables are impractical unless we have loads of memory to spare (<strong>spoiler</strong>: not many people have memory to spare when it comes to SQL Servers)</li>
<li>Compression is not supported for in-memory tables, this gives these objects an even higher memory footprint.</li>
</ul>
<h4><strong>Indexing</strong></h4>
<ul>
<li>The following index types are not supported
<ul>
<li>Clustered Indexes</li>
<li>Filtered Indexes</li>
<li>Non-clustered indexes that have included columns</li>
</ul>
</li>
<li>You must also be very considerate of your hash index bucket sizes.
<ul>
<li><strong>Too few</strong>: Bad performance from long chains and collisions</li>
<li><strong>Too many</strong>: Wasted memory (buckets are allocated up front and never shrink)</li>
</ul>
</li>
<li>Index rebuilds and reorganize operations are not supported, only drop/create to achieve the same goal</li>
</ul>
<h4>T-SQL Limitations</h4>
<ul>
<li>No check constraints</li>
<li>No foreign key cascades</li>
<li>No foreign keys referencing disk based tables from in-memory tables</li>
<li>There are unsupported data types depending upon your SQL Server version</li>
<li>No IDENTITY columns</li>
<li>No Merge statement (not a bad thing in one DBA’s opinion, at least)</li>
</ul>
<h3></h3>
<h3>Should You Use Memory-Optimized Tables in SQL Server?</h3>
<p>Ultimately, if you’re considering using in-memory tables, I would recommend researching the advantages and disadvantages extensively. You would be well advised to test on a large dataset (a copy of production is ideal, <strong>because you’re not testing in production, <em>right?</em></strong>) to see how your specific workload would react to using in-memory tables.</p>
<p>Have you implemented in-memory tables and are they working well for you? We&#8217;d love to hear about your experiences, so share your story in the comments below.</p>
<p>The post <a href="https://sqlsolutionsgroup.com/memory-optimized-tables-in-sql-server/">An introduction to Memory-Optimized Tables in SQL Server</a> appeared first on <a href="https://sqlsolutionsgroup.com">SQL Solutions Group</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://sqlsolutionsgroup.com/memory-optimized-tables-in-sql-server/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Removing Personally Identifiable Information in Development Environments</title>
		<link>https://sqlsolutionsgroup.com/removing-personally-identifiable-information/</link>
					<comments>https://sqlsolutionsgroup.com/removing-personally-identifiable-information/#respond</comments>
		
		<dc:creator><![CDATA[Rich Benner]]></dc:creator>
		<pubDate>Wed, 30 Jul 2025 10:31:36 +0000</pubDate>
				<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[#devenvironment]]></category>
		<category><![CDATA[#testing]]></category>
		<category><![CDATA[Developer]]></category>
		<guid isPermaLink="false">https://sqlsolutionsgroup.com/?p=7276</guid>

					<description><![CDATA[<p>When testing code, it's critical to have enough robust data. This often requires removing personally identifiable information. Find out how!</p>
<p>The post <a href="https://sqlsolutionsgroup.com/removing-personally-identifiable-information/">Removing Personally Identifiable Information in Development Environments</a> appeared first on <a href="https://sqlsolutionsgroup.com">SQL Solutions Group</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p>Working with robust, sizeable data in your development environments is an important part of testing. A critical consideration prior to testing in dev is removing personally identifiable information. Because, of course, you’re not testing code in your production environment, right? … <em><strong>RIGHT?</strong></em></p>



<p>OK, now we have that out of the way, we’re going to proceed with the assumption that you&#8217;re working in some sort of development environment. That can be a specific server or even just a database on a developer’s laptop. It doesn’t matter where it is.</p>



<p>The main issue we see in dev environments is that people take a nice little version of their database, a few hundred rows of data per table, and develop on that. This is great for checking that your logic is correct, <strong>but not good when it comes to actually deploying the code to production</strong>. Suddenly, your nice, pretty code has to deal with millions of rows of data and grinds to a halt because you didn’t write it for big data sets. No, you wrote it for your development system, and it was fast on your machine. <strong>We see this <span style="text-decoration: underline;">a lot</span></strong>.</p>



<h3 class="wp-block-heading"><em><strong>What to do? </strong></em></h3>



<p>The obvious fix for this is to take a copy of your production database (most people grab the last full backup) and restore onto a similarly sized server to use for testing. This way you’re testing as close as you can to the production database size. This is an excellent idea, especially if you have a team or process that can run a workload against this development machine to simulate a real workload.</p>



<p>If you choose to do this, you’ll often hit the problem of<em> using real people’s personally identifiable information (PII)</em>. In certain environments (e.g. healthcare, banking), we don’t want people to have access to this customer data. We still want the data <em><strong>size</strong></em> but we have to sanitize this data before it’s safe to test with. This post walks you through the process.</p>



<h3 class="wp-block-heading">Removing Personally Identifiable Information</h3>



<p>We’re focusing on a couple different data types here — names and phone numbers. There are a lot more data types that qualify as PII, but you don’t want to read a 20 page essay. What we’ll do here is to <strong>show you the principle</strong>. You can then modify these scripts to meet your specific needs and/or data types.</p>



<h4 class="wp-block-heading">Phone Numbers</h4>



<p>We’ll start by anonymizing phone numbers. This data is much simpler to change than names, and numbers are also easier to deal with than people (hey, we’re not in this career path because we like dealing with people 😂).</p>



<p>OK, let’s make a temporary table with some totally real phone numbers for our testing;</p>


<div id="wpshdo_20" class="wp-synhighlighter-outer"><div id="wpshdt_20" class="wp-synhighlighter-expanded"><table border="0" width="100%"><tr><td align="left" width="80%"><a name="#codesyntax_20"></a><a id="wpshat_20" class="wp-synhighlighter-title" href="#codesyntax_20"  onClick="javascript:wpsh_toggleBlock(20)" title="Click to show/hide code block">Source code</a></td><td align="right"><a href="#codesyntax_20" onClick="javascript:wpsh_code(20)" title="Show code only"><img decoding="async" border="0" style="border: 0 none" src="https://sqlsolutionsgroup.com/wp-content/plugins/wp-synhighlight/themes/default/images/code.png" /></a>&nbsp;<a href="#codesyntax_20" onClick="javascript:wpsh_print(20)" title="Print code"><img decoding="async" border="0" style="border: 0 none" src="https://sqlsolutionsgroup.com/wp-content/plugins/wp-synhighlight/themes/default/images/printer.png" /></a>&nbsp;<a href="https://sqlsolutionsgroup.com/wp-content/plugins/wp-synhighlight/About.html" target="_blank" title="Show plugin information"><img decoding="async" border="0" style="border: 0 none" src="https://sqlsolutionsgroup.com/wp-content/plugins/wp-synhighlight/themes/default/images/info.gif" /></a>&nbsp;</td></tr></table></div><div id="wpshdi_20" class="wp-synhighlighter-inner" style="display: block;"><pre class="tsql" style="font-family:monospace;"><span class="kw1">IF</span> <span class="kw2">OBJECT_ID</span><span class="br0">&#40;</span><span class="st0">'tempdb..#PhoneNumbers'</span><span class="br0">&#41;</span> <span class="kw1">IS</span> <span class="sy0">NOT</span> <span class="sy0">NULL</span> <span class="kw1">DROP</span> <span class="kw1">TABLE</span> #PhoneNumbers;
&nbsp;
<span class="kw1">CREATE</span> <span class="kw1">TABLE</span> #PhoneNumbers <span class="br0">&#40;</span>PhoneNumbers <span class="kw1">VARCHAR</span><span class="br0">&#40;</span>20<span class="br0">&#41;</span><span class="br0">&#41;</span>
&nbsp;
<span class="kw1">INSERT</span> <span class="kw1">INTO</span> #PhoneNumbers
&nbsp;
<span class="kw1">VALUES</span>
&nbsp;
<span class="br0">&#40;</span><span class="st0">'(111) 111 1111'</span><span class="br0">&#41;</span>
&nbsp;
,<span class="br0">&#40;</span><span class="st0">'(222) 222 2222'</span><span class="br0">&#41;</span>
&nbsp;
,<span class="br0">&#40;</span><span class="st0">'(333) 333 3333'</span><span class="br0">&#41;</span>
&nbsp;
,<span class="br0">&#40;</span><span class="st0">'(444) 444 4444'</span><span class="br0">&#41;</span>
&nbsp;
,<span class="br0">&#40;</span><span class="st0">'(555) 555 5555'</span><span class="br0">&#41;</span></pre></div></div>



<p>&nbsp;</p>



<p>Yes, this is very simple, but it’ll work just fine for this test.</p>



<p>Now we’re going to want to follow whatever format our phone numbers are in. I’ve included brackets and spaces just because I’m a bit of a masochist. Adapt this for whatever format your tables use.</p>



<p>Right: The reason we’ve started with phone numbers is because SQL Server is pretty good at just generating numbers out of thin air. We’re going to use the <a href="https://learn.microsoft.com/en-us/sql/t-sql/functions/crypt-gen-random-transact-sql?view=sql-server-ver17">CRYPT_GEN_RANDOM</a> function to generate our random values. We’ll then convert this to an INT to give us a random string of at least 4 integer values.</p>


<div id="wpshdo_21" class="wp-synhighlighter-outer"><div id="wpshdt_21" class="wp-synhighlighter-expanded"><table border="0" width="100%"><tr><td align="left" width="80%"><a name="#codesyntax_21"></a><a id="wpshat_21" class="wp-synhighlighter-title" href="#codesyntax_21"  onClick="javascript:wpsh_toggleBlock(21)" title="Click to show/hide code block">Source code</a></td><td align="right"><a href="#codesyntax_21" onClick="javascript:wpsh_code(21)" title="Show code only"><img decoding="async" border="0" style="border: 0 none" src="https://sqlsolutionsgroup.com/wp-content/plugins/wp-synhighlight/themes/default/images/code.png" /></a>&nbsp;<a href="#codesyntax_21" onClick="javascript:wpsh_print(21)" title="Print code"><img decoding="async" border="0" style="border: 0 none" src="https://sqlsolutionsgroup.com/wp-content/plugins/wp-synhighlight/themes/default/images/printer.png" /></a>&nbsp;<a href="https://sqlsolutionsgroup.com/wp-content/plugins/wp-synhighlight/About.html" target="_blank" title="Show plugin information"><img decoding="async" border="0" style="border: 0 none" src="https://sqlsolutionsgroup.com/wp-content/plugins/wp-synhighlight/themes/default/images/info.gif" /></a>&nbsp;</td></tr></table></div><div id="wpshdi_21" class="wp-synhighlighter-inner" style="display: block;"><pre class="tsql" style="font-family:monospace;"><span class="kw1">SELECT</span> <span class="kw1">CONVERT</span><span class="br0">&#40;</span><span class="kw1">INT</span>,CRYPT_GEN_R<span class="sy0">AND</span>OM<span class="br0">&#40;</span><span class="nu0">2</span><span class="br0">&#41;</span><span class="br0">&#41;</span></pre></div></div>



<p>&nbsp;</p>



<p>Run this a bunch of times. You’ll see that it’s going to randomise numbers for us. We can do a bit of messing about and get this in the format we want;</p>


<div id="wpshdo_22" class="wp-synhighlighter-outer"><div id="wpshdt_22" class="wp-synhighlighter-expanded"><table border="0" width="100%"><tr><td align="left" width="80%"><a name="#codesyntax_22"></a><a id="wpshat_22" class="wp-synhighlighter-title" href="#codesyntax_22"  onClick="javascript:wpsh_toggleBlock(22)" title="Click to show/hide code block">Source code</a></td><td align="right"><a href="#codesyntax_22" onClick="javascript:wpsh_code(22)" title="Show code only"><img decoding="async" border="0" style="border: 0 none" src="https://sqlsolutionsgroup.com/wp-content/plugins/wp-synhighlight/themes/default/images/code.png" /></a>&nbsp;<a href="#codesyntax_22" onClick="javascript:wpsh_print(22)" title="Print code"><img decoding="async" border="0" style="border: 0 none" src="https://sqlsolutionsgroup.com/wp-content/plugins/wp-synhighlight/themes/default/images/printer.png" /></a>&nbsp;<a href="https://sqlsolutionsgroup.com/wp-content/plugins/wp-synhighlight/About.html" target="_blank" title="Show plugin information"><img decoding="async" border="0" style="border: 0 none" src="https://sqlsolutionsgroup.com/wp-content/plugins/wp-synhighlight/themes/default/images/info.gif" /></a>&nbsp;</td></tr></table></div><div id="wpshdi_22" class="wp-synhighlighter-inner" style="display: block;"><pre class="tsql" style="font-family:monospace;"><span class="kw1">SELECT</span>
&nbsp;
<span class="st0">'('</span> <span class="sy0">+</span> <span class="kw1">LEFT</span><span class="br0">&#40;</span><span class="kw1">CONVERT</span><span class="br0">&#40;</span><span class="kw1">VARCHAR</span>,<span class="kw1">CONVERT</span><span class="br0">&#40;</span><span class="kw1">INT</span>,CRYPT_GEN_R<span class="sy0">AND</span>OM<span class="br0">&#40;</span><span class="nu0">2</span><span class="br0">&#41;</span><span class="br0">&#41;</span><span class="br0">&#41;</span>,<span class="nu0">3</span><span class="br0">&#41;</span> <span class="sy0">+</span> <span class="st0">')'</span>
&nbsp;
<span class="sy0">+</span> <span class="st0">' '</span>
&nbsp;
<span class="sy0">+</span> <span class="kw1">LEFT</span><span class="br0">&#40;</span><span class="kw1">CONVERT</span><span class="br0">&#40;</span><span class="kw1">VARCHAR</span>,<span class="kw1">CONVERT</span><span class="br0">&#40;</span><span class="kw1">INT</span>,CRYPT_GEN_R<span class="sy0">AND</span>OM<span class="br0">&#40;</span><span class="nu0">2</span><span class="br0">&#41;</span><span class="br0">&#41;</span><span class="br0">&#41;</span>,<span class="nu0">3</span><span class="br0">&#41;</span>
&nbsp;
<span class="sy0">+</span> <span class="st0">' '</span>
&nbsp;
<span class="sy0">+</span> <span class="kw1">LEFT</span><span class="br0">&#40;</span><span class="kw1">CONVERT</span><span class="br0">&#40;</span><span class="kw1">VARCHAR</span>,<span class="kw1">CONVERT</span><span class="br0">&#40;</span><span class="kw1">INT</span>,CRYPT_GEN_R<span class="sy0">AND</span>OM<span class="br0">&#40;</span><span class="nu0">2</span><span class="br0">&#41;</span><span class="br0">&#41;</span><span class="br0">&#41;</span>,<span class="nu0">4</span><span class="br0">&#41;</span></pre></div></div>



<p>&nbsp;</p>



<p>We’ve added the brackets and spaces where we need for our format. <strong>Modify this as needed.</strong></p>



<p>Now, we can use this function and update our temp table;</p>


<div id="wpshdo_23" class="wp-synhighlighter-outer"><div id="wpshdt_23" class="wp-synhighlighter-expanded"><table border="0" width="100%"><tr><td align="left" width="80%"><a name="#codesyntax_23"></a><a id="wpshat_23" class="wp-synhighlighter-title" href="#codesyntax_23"  onClick="javascript:wpsh_toggleBlock(23)" title="Click to show/hide code block">Source code</a></td><td align="right"><a href="#codesyntax_23" onClick="javascript:wpsh_code(23)" title="Show code only"><img decoding="async" border="0" style="border: 0 none" src="https://sqlsolutionsgroup.com/wp-content/plugins/wp-synhighlight/themes/default/images/code.png" /></a>&nbsp;<a href="#codesyntax_23" onClick="javascript:wpsh_print(23)" title="Print code"><img decoding="async" border="0" style="border: 0 none" src="https://sqlsolutionsgroup.com/wp-content/plugins/wp-synhighlight/themes/default/images/printer.png" /></a>&nbsp;<a href="https://sqlsolutionsgroup.com/wp-content/plugins/wp-synhighlight/About.html" target="_blank" title="Show plugin information"><img decoding="async" border="0" style="border: 0 none" src="https://sqlsolutionsgroup.com/wp-content/plugins/wp-synhighlight/themes/default/images/info.gif" /></a>&nbsp;</td></tr></table></div><div id="wpshdi_23" class="wp-synhighlighter-inner" style="display: block;"><pre class="tsql" style="font-family:monospace;"><span class="kw1">UPDATE</span> #PhoneNumbers
&nbsp;
<span class="kw1">SET</span> PhoneNumbers <span class="sy0">=</span> <span class="st0">'('</span> <span class="sy0">+</span> <span class="kw1">LEFT</span><span class="br0">&#40;</span><span class="kw1">CONVERT</span><span class="br0">&#40;</span><span class="kw1">VARCHAR</span>,<span class="kw1">CONVERT</span><span class="br0">&#40;</span><span class="kw1">INT</span>,CRYPT_GEN_R<span class="sy0">AND</span>OM<span class="br0">&#40;</span><span class="nu0">2</span><span class="br0">&#41;</span><span class="br0">&#41;</span><span class="br0">&#41;</span>,<span class="nu0">3</span><span class="br0">&#41;</span> <span class="sy0">+</span> <span class="st0">')'</span>
&nbsp;
<span class="sy0">+</span> <span class="st0">' '</span>
&nbsp;
<span class="sy0">+</span> <span class="kw1">LEFT</span><span class="br0">&#40;</span><span class="kw1">CONVERT</span><span class="br0">&#40;</span><span class="kw1">VARCHAR</span>,<span class="kw1">CONVERT</span><span class="br0">&#40;</span><span class="kw1">INT</span>,CRYPT_GEN_R<span class="sy0">AND</span>OM<span class="br0">&#40;</span><span class="nu0">2</span><span class="br0">&#41;</span><span class="br0">&#41;</span><span class="br0">&#41;</span>,<span class="nu0">3</span><span class="br0">&#41;</span>
&nbsp;
<span class="sy0">+</span> <span class="st0">' '</span>
&nbsp;
<span class="sy0">+</span> <span class="kw1">LEFT</span><span class="br0">&#40;</span><span class="kw1">CONVERT</span><span class="br0">&#40;</span><span class="kw1">VARCHAR</span>,<span class="kw1">CONVERT</span><span class="br0">&#40;</span><span class="kw1">INT</span>,CRYPT_GEN_R<span class="sy0">AND</span>OM<span class="br0">&#40;</span><span class="nu0">2</span><span class="br0">&#41;</span><span class="br0">&#41;</span><span class="br0">&#41;</span>,<span class="nu0">4</span><span class="br0">&#41;</span></pre></div></div>



<p>&nbsp;</p>



<p>The results in my test look like this;</p>



<figure class="wp-block-image"><img loading="lazy" decoding="async" width="154" height="147" src="https://sqlsolutionsgroup.com/wp-content/uploads/2025/07/a-screenshot-of-a-phone-number-ai-generated-conte.png" alt="A screenshot of a phone number AI-generated content may be incorrect." class="wp-image-7277"/></figure>



<p></p>



<p>This method <strong>can be used for any data that contains only values that are integers</strong>. It won&#8217;t work for randomly generating names or other text-based data. We’ll need a different approach for these.</p>



<h4 class="wp-block-heading">Generating Names</h4>



<p>First of all, test data:</p>


<div id="wpshdo_24" class="wp-synhighlighter-outer"><div id="wpshdt_24" class="wp-synhighlighter-expanded"><table border="0" width="100%"><tr><td align="left" width="80%"><a name="#codesyntax_24"></a><a id="wpshat_24" class="wp-synhighlighter-title" href="#codesyntax_24"  onClick="javascript:wpsh_toggleBlock(24)" title="Click to show/hide code block">Source code</a></td><td align="right"><a href="#codesyntax_24" onClick="javascript:wpsh_code(24)" title="Show code only"><img decoding="async" border="0" style="border: 0 none" src="https://sqlsolutionsgroup.com/wp-content/plugins/wp-synhighlight/themes/default/images/code.png" /></a>&nbsp;<a href="#codesyntax_24" onClick="javascript:wpsh_print(24)" title="Print code"><img decoding="async" border="0" style="border: 0 none" src="https://sqlsolutionsgroup.com/wp-content/plugins/wp-synhighlight/themes/default/images/printer.png" /></a>&nbsp;<a href="https://sqlsolutionsgroup.com/wp-content/plugins/wp-synhighlight/About.html" target="_blank" title="Show plugin information"><img decoding="async" border="0" style="border: 0 none" src="https://sqlsolutionsgroup.com/wp-content/plugins/wp-synhighlight/themes/default/images/info.gif" /></a>&nbsp;</td></tr></table></div><div id="wpshdi_24" class="wp-synhighlighter-inner" style="display: block;"><pre class="tsql" style="font-family:monospace;"><span class="kw1">IF</span> <span class="kw2">OBJECT_ID</span><span class="br0">&#40;</span><span class="st0">'tempdb..#TotallyRealNames'</span><span class="br0">&#41;</span> <span class="kw1">IS</span> <span class="sy0">NOT</span> <span class="sy0">NULL</span> <span class="kw1">DROP</span> <span class="kw1">TABLE</span> #TotallyRealNames;
&nbsp;
<span class="kw1">CREATE</span> <span class="kw1">TABLE</span> #TotallyRealNames
&nbsp;
<span class="br0">&#40;</span>
&nbsp;
ARealPersonsName <span class="kw1">VARCHAR</span><span class="br0">&#40;</span>20<span class="br0">&#41;</span>
&nbsp;
<span class="br0">&#41;</span>
&nbsp;
<span class="kw1">INSERT</span> <span class="kw1">INTO</span> #TotallyRealNames <span class="br0">&#40;</span>ARealPersonsName<span class="br0">&#41;</span>
&nbsp;
<span class="kw1">VALUES</span>
&nbsp;
<span class="br0">&#40;</span><span class="st0">'Aaron'</span><span class="br0">&#41;</span>,<span class="br0">&#40;</span><span class="st0">'Abron'</span><span class="br0">&#41;</span>,<span class="br0">&#40;</span><span class="st0">'Acron'</span><span class="br0">&#41;</span>,<span class="br0">&#40;</span><span class="st0">'Adron'</span><span class="br0">&#41;</span>,<span class="br0">&#40;</span><span class="st0">'Aeron'</span><span class="br0">&#41;</span></pre></div></div>



<p>&nbsp;</p>



<p>We can’t just randomly generate data (well, we <strong><em>could</em></strong>, but: the names would just be random strings of letters and wouldn’t be very nice to work with). So, instead, let’s go grab some names.</p>



<p>For this data here, I went to data.gov and got the top 100 baby names from a CSV list. The test data below is not the full 100 names, but you can grab a list of names from any publicly available list on the net (please check any applicable licences).</p>


<div id="wpshdo_25" class="wp-synhighlighter-outer"><div id="wpshdt_25" class="wp-synhighlighter-expanded"><table border="0" width="100%"><tr><td align="left" width="80%"><a name="#codesyntax_25"></a><a id="wpshat_25" class="wp-synhighlighter-title" href="#codesyntax_25"  onClick="javascript:wpsh_toggleBlock(25)" title="Click to show/hide code block">Source code</a></td><td align="right"><a href="#codesyntax_25" onClick="javascript:wpsh_code(25)" title="Show code only"><img decoding="async" border="0" style="border: 0 none" src="https://sqlsolutionsgroup.com/wp-content/plugins/wp-synhighlight/themes/default/images/code.png" /></a>&nbsp;<a href="#codesyntax_25" onClick="javascript:wpsh_print(25)" title="Print code"><img decoding="async" border="0" style="border: 0 none" src="https://sqlsolutionsgroup.com/wp-content/plugins/wp-synhighlight/themes/default/images/printer.png" /></a>&nbsp;<a href="https://sqlsolutionsgroup.com/wp-content/plugins/wp-synhighlight/About.html" target="_blank" title="Show plugin information"><img decoding="async" border="0" style="border: 0 none" src="https://sqlsolutionsgroup.com/wp-content/plugins/wp-synhighlight/themes/default/images/info.gif" /></a>&nbsp;</td></tr></table></div><div id="wpshdi_25" class="wp-synhighlighter-inner" style="display: block;"><pre class="tsql" style="font-family:monospace;"><span class="kw1">CREATE</span> <span class="kw1">TABLE</span> #FirstNames
&nbsp;
<span class="br0">&#40;</span>
&nbsp;
ID <span class="kw1">INT</span> <span class="kw1">IDENTITY</span><span class="br0">&#40;</span>1,1<span class="br0">&#41;</span>
&nbsp;
,FirstName <span class="kw1">VARCHAR</span><span class="br0">&#40;</span>100<span class="br0">&#41;</span>
&nbsp;
<span class="br0">&#41;</span>
&nbsp;
<span class="kw1">INSERT</span> <span class="kw1">INTO</span> #FirstNames <span class="br0">&#40;</span>FirstName<span class="br0">&#41;</span>
&nbsp;
<span class="kw1">VALUES</span> <span class="br0">&#40;</span><span class="st0">'GERALDINE'</span><span class="br0">&#41;</span>,<span class="br0">&#40;</span><span class="st0">'GIA'</span><span class="br0">&#41;</span>,<span class="br0">&#40;</span><span class="st0">'GIANNA'</span><span class="br0">&#41;</span>,<span class="br0">&#40;</span><span class="st0">'GISELLE'</span><span class="br0">&#41;</span>,<span class="br0">&#40;</span><span class="st0">'GRACE'</span><span class="br0">&#41;</span>,<span class="br0">&#40;</span><span class="st0">'GUADALUPE'</span><span class="br0">&#41;</span>,<span class="br0">&#40;</span><span class="st0">'HAILEY'</span><span class="br0">&#41;</span>,<span class="br0">&#40;</span><span class="st0">'HALEY'</span><span class="br0">&#41;</span>,<span class="br0">&#40;</span><span class="st0">'HANNAH'</span><span class="br0">&#41;</span>,<span class="br0">&#40;</span><span class="st0">'HAYLEE'</span><span class="br0">&#41;</span></pre></div></div>



<p>&nbsp;</p>



<p>We now have a list of 10 names that we can apply to our main table and replace. The issue here is that we want to apply only one name to each row of data in the main table. We’re going to have to use some sort of TOP (1) statement here, however, if we were to do a simple join like this &#8230;</p>


<div id="wpshdo_26" class="wp-synhighlighter-outer"><div id="wpshdt_26" class="wp-synhighlighter-expanded"><table border="0" width="100%"><tr><td align="left" width="80%"><a name="#codesyntax_26"></a><a id="wpshat_26" class="wp-synhighlighter-title" href="#codesyntax_26"  onClick="javascript:wpsh_toggleBlock(26)" title="Click to show/hide code block">Source code</a></td><td align="right"><a href="#codesyntax_26" onClick="javascript:wpsh_code(26)" title="Show code only"><img decoding="async" border="0" style="border: 0 none" src="https://sqlsolutionsgroup.com/wp-content/plugins/wp-synhighlight/themes/default/images/code.png" /></a>&nbsp;<a href="#codesyntax_26" onClick="javascript:wpsh_print(26)" title="Print code"><img decoding="async" border="0" style="border: 0 none" src="https://sqlsolutionsgroup.com/wp-content/plugins/wp-synhighlight/themes/default/images/printer.png" /></a>&nbsp;<a href="https://sqlsolutionsgroup.com/wp-content/plugins/wp-synhighlight/About.html" target="_blank" title="Show plugin information"><img decoding="async" border="0" style="border: 0 none" src="https://sqlsolutionsgroup.com/wp-content/plugins/wp-synhighlight/themes/default/images/info.gif" /></a>&nbsp;</td></tr></table></div><div id="wpshdi_26" class="wp-synhighlighter-inner" style="display: block;"><pre class="tsql" style="font-family:monospace;"><span class="kw1">UPDATE</span> #TotallyRealNames
&nbsp;
<span class="kw1">SET</span> ARealPersonsName <span class="sy0">=</span> <span class="br0">&#40;</span><span class="kw1">SELECT</span> <span class="kw1">TOP</span> <span class="br0">&#40;</span>1<span class="br0">&#41;</span> FirstName <span class="kw1">FROM</span> #FirstNames<span class="br0">&#41;</span></pre></div></div>



<p>&nbsp;</p>



<p>&#8230; we’re going to have a problem:</p>



<figure class="wp-block-image"><img loading="lazy" decoding="async" width="157" height="149" src="https://sqlsolutionsgroup.com/wp-content/uploads/2025/07/a-screenshot-of-a-computer-ai-generated-content-m-1.png" alt="A screenshot of a computer AI-generated content may be incorrect." class="wp-image-7278"/></figure>



<p></p>



<p>Just one name has been used to replace all of our original data. That’s no fun. To fix this, we’ll have to do some funky nonsense to get us a random selection of names in here.</p>


<div id="wpshdo_27" class="wp-synhighlighter-outer"><div id="wpshdt_27" class="wp-synhighlighter-expanded"><table border="0" width="100%"><tr><td align="left" width="80%"><a name="#codesyntax_27"></a><a id="wpshat_27" class="wp-synhighlighter-title" href="#codesyntax_27"  onClick="javascript:wpsh_toggleBlock(27)" title="Click to show/hide code block">Source code</a></td><td align="right"><a href="#codesyntax_27" onClick="javascript:wpsh_code(27)" title="Show code only"><img decoding="async" border="0" style="border: 0 none" src="https://sqlsolutionsgroup.com/wp-content/plugins/wp-synhighlight/themes/default/images/code.png" /></a>&nbsp;<a href="#codesyntax_27" onClick="javascript:wpsh_print(27)" title="Print code"><img decoding="async" border="0" style="border: 0 none" src="https://sqlsolutionsgroup.com/wp-content/plugins/wp-synhighlight/themes/default/images/printer.png" /></a>&nbsp;<a href="https://sqlsolutionsgroup.com/wp-content/plugins/wp-synhighlight/About.html" target="_blank" title="Show plugin information"><img decoding="async" border="0" style="border: 0 none" src="https://sqlsolutionsgroup.com/wp-content/plugins/wp-synhighlight/themes/default/images/info.gif" /></a>&nbsp;</td></tr></table></div><div id="wpshdi_27" class="wp-synhighlighter-inner" style="display: block;"><pre class="tsql" style="font-family:monospace;">Funky Nonsense;
&nbsp;
;WITH OriginalData_CTE <span class="kw1">AS</span>
&nbsp;
<span class="br0">&#40;</span>
&nbsp;
<span class="kw1">SELECT</span>
&nbsp;
trn.<span class="me1">ARealPersonsName</span>
&nbsp;
,<span class="kw1">LEFT</span><span class="br0">&#40;</span>1 <span class="sy0">+</span> 200 <span class="sy0">*</span> <span class="br0">&#40;</span><span class="kw1">CAST</span><span class="br0">&#40;</span>CRYPT_GEN_R<span class="sy0">AND</span>OM<span class="br0">&#40;</span>4<span class="br0">&#41;</span> <span class="kw1">AS</span> <span class="kw1">INT</span><span class="br0">&#41;</span> <span class="sy0">/</span> 4294967295.0 <span class="sy0">+</span> 0.5<span class="br0">&#41;</span>,1<span class="br0">&#41;</span> <span class="kw1">AS</span> random_number
&nbsp;
<span class="kw1">FROM</span> #TotallyRealNames <span class="kw1">AS</span> trn
&nbsp;
<span class="br0">&#41;</span>
&nbsp;
,UpdateData_CTE <span class="kw1">AS</span>
&nbsp;
<span class="br0">&#40;</span>
&nbsp;
<span class="kw1">SELECT</span>
&nbsp;
od.<span class="me1">ARealPersonsName</span>
&nbsp;
,<span class="kw1">NEW</span>.<span class="me1">FirstName</span>
&nbsp;
<span class="kw1">FROM</span>
&nbsp;
OriginalData_CTE od
&nbsp;
<span class="sy0">OUTER</span> APPLY
&nbsp;
<span class="br0">&#40;</span>
&nbsp;
<span class="kw1">SELECT</span> fn.<span class="me1">FirstName</span>
&nbsp;
<span class="kw1">FROM</span> #FirstNames <span class="kw1">AS</span> fn
&nbsp;
<span class="kw1">WHERE</span> fn.<span class="me1">ID</span> <span class="sy0">=</span> <span class="kw1">CAST</span><span class="br0">&#40;</span>od.<span class="me1">random_number</span> <span class="kw1">AS</span> <span class="kw1">INT</span><span class="br0">&#41;</span>
&nbsp;
<span class="br0">&#41;</span> <span class="kw1">AS</span> <span class="kw1">NEW</span>
&nbsp;
<span class="br0">&#41;</span>
&nbsp;
<span class="kw1">UPDATE</span> UpdateData_CTE
&nbsp;
<span class="kw1">SET</span> ARealPersonsName <span class="sy0">=</span> FirstName</pre></div></div>



<p>I did warn you… OK, let’s break down what this code does.</p>



<p>The first CTE uses our friend CRYPT_GEN_RANDOM to generate a random int value for each row of our table. Because we only have 10 rows of data in our list of names, I have included the LEFT(,1) statement so we only return one digit. Because of this, you’re likely to see duplicates in our output data. However, if you have a sensible amount of names in your replacement list (e.g. 3 or 4 digits worth), then you won’t see these.</p>


<div id="wpshdo_28" class="wp-synhighlighter-outer"><div id="wpshdt_28" class="wp-synhighlighter-expanded"><table border="0" width="100%"><tr><td align="left" width="80%"><a name="#codesyntax_28"></a><a id="wpshat_28" class="wp-synhighlighter-title" href="#codesyntax_28"  onClick="javascript:wpsh_toggleBlock(28)" title="Click to show/hide code block">Source code</a></td><td align="right"><a href="#codesyntax_28" onClick="javascript:wpsh_code(28)" title="Show code only"><img decoding="async" border="0" style="border: 0 none" src="https://sqlsolutionsgroup.com/wp-content/plugins/wp-synhighlight/themes/default/images/code.png" /></a>&nbsp;<a href="#codesyntax_28" onClick="javascript:wpsh_print(28)" title="Print code"><img decoding="async" border="0" style="border: 0 none" src="https://sqlsolutionsgroup.com/wp-content/plugins/wp-synhighlight/themes/default/images/printer.png" /></a>&nbsp;<a href="https://sqlsolutionsgroup.com/wp-content/plugins/wp-synhighlight/About.html" target="_blank" title="Show plugin information"><img decoding="async" border="0" style="border: 0 none" src="https://sqlsolutionsgroup.com/wp-content/plugins/wp-synhighlight/themes/default/images/info.gif" /></a>&nbsp;</td></tr></table></div><div id="wpshdi_28" class="wp-synhighlighter-inner" style="display: block;"><pre class="tsql" style="font-family:monospace;">;WITH OriginalData_CTE <span class="kw1">AS</span>
&nbsp;
<span class="br0">&#40;</span>
&nbsp;
<span class="kw1">SELECT</span>
&nbsp;
trn.<span class="me1">ARealPersonsName</span>
&nbsp;
,<span class="kw1">LEFT</span><span class="br0">&#40;</span>1 <span class="sy0">+</span> 200 <span class="sy0">*</span> <span class="br0">&#40;</span><span class="kw1">CAST</span><span class="br0">&#40;</span>CRYPT_GEN_R<span class="sy0">AND</span>OM<span class="br0">&#40;</span>4<span class="br0">&#41;</span> <span class="kw1">AS</span> <span class="kw1">INT</span><span class="br0">&#41;</span> <span class="sy0">/</span> 4294967295.0 <span class="sy0">+</span> 0.5<span class="br0">&#41;</span>,1<span class="br0">&#41;</span> <span class="kw1">AS</span> random_number
&nbsp;
<span class="kw1">FROM</span> #TotallyRealNames <span class="kw1">AS</span> trn
&nbsp;
<span class="br0">&#41;</span></pre></div></div>



<p>The second CTE joins this random number to the ID value of the data in our replacement data:</p>


<div id="wpshdo_29" class="wp-synhighlighter-outer"><div id="wpshdt_29" class="wp-synhighlighter-expanded"><table border="0" width="100%"><tr><td align="left" width="80%"><a name="#codesyntax_29"></a><a id="wpshat_29" class="wp-synhighlighter-title" href="#codesyntax_29"  onClick="javascript:wpsh_toggleBlock(29)" title="Click to show/hide code block">Source code</a></td><td align="right"><a href="#codesyntax_29" onClick="javascript:wpsh_code(29)" title="Show code only"><img decoding="async" border="0" style="border: 0 none" src="https://sqlsolutionsgroup.com/wp-content/plugins/wp-synhighlight/themes/default/images/code.png" /></a>&nbsp;<a href="#codesyntax_29" onClick="javascript:wpsh_print(29)" title="Print code"><img decoding="async" border="0" style="border: 0 none" src="https://sqlsolutionsgroup.com/wp-content/plugins/wp-synhighlight/themes/default/images/printer.png" /></a>&nbsp;<a href="https://sqlsolutionsgroup.com/wp-content/plugins/wp-synhighlight/About.html" target="_blank" title="Show plugin information"><img decoding="async" border="0" style="border: 0 none" src="https://sqlsolutionsgroup.com/wp-content/plugins/wp-synhighlight/themes/default/images/info.gif" /></a>&nbsp;</td></tr></table></div><div id="wpshdi_29" class="wp-synhighlighter-inner" style="display: block;"><pre class="tsql" style="font-family:monospace;">,UpdateData_CTE <span class="kw1">AS</span>
&nbsp;
<span class="br0">&#40;</span>
&nbsp;
<span class="kw1">SELECT</span>
&nbsp;
od.<span class="me1">ARealPersonsName</span>
&nbsp;
,<span class="kw1">NEW</span>.<span class="me1">FirstName</span>
&nbsp;
<span class="kw1">FROM</span>
&nbsp;
OriginalData_CTE od
&nbsp;
<span class="sy0">OUTER</span> APPLY
&nbsp;
<span class="br0">&#40;</span>
&nbsp;
<span class="kw1">SELECT</span> fn.<span class="me1">FirstName</span>
&nbsp;
<span class="kw1">FROM</span> #FirstNames <span class="kw1">AS</span> fn
&nbsp;
<span class="kw1">WHERE</span> fn.<span class="me1">ID</span> <span class="sy0">=</span> <span class="kw1">CAST</span><span class="br0">&#40;</span>od.<span class="me1">random_number</span> <span class="kw1">AS</span> <span class="kw1">INT</span><span class="br0">&#41;</span>
&nbsp;
<span class="br0">&#41;</span> <span class="kw1">AS</span> <span class="kw1">NEW</span>
&nbsp;
<span class="br0">&#41;</span></pre></div></div>



<p>This output will allow the update to happen and actually update our table. At this point, your data should look something like this;</p>



<figure class="wp-block-image"><img loading="lazy" decoding="async" width="183" height="160" src="https://sqlsolutionsgroup.com/wp-content/uploads/2025/07/a-screenshot-of-a-computer-ai-generated-content-m-2.png" alt="A screenshot of a computer AI-generated content may be incorrect." class="wp-image-7279"/></figure>



<p></p>



<p>You’ll see the duplicate in the output, but that’ll happen with such small data sets.</p>



<h3 class="wp-block-heading">What Have We Achieved?</h3>



<p>At this point, you’ve got customer data that’s PII phone numbers and names replaced with sensible-looking but completely anonymous data, ready for development to safely test against.</p>



<p>There’s a lot more you can do with this approach if needed. The obvious next steps are to use the phone number script for fax numbers and cell numbers, but you can use the text replacement to also do full names, email addresses and anything else that uses a person’s name.</p>



<p>At this point, the only thing left is to go through every column of data in your database and identify exactly which columns are PII, I’ll leave that particular part of this process to you and your expert knowledge of your own environment.</p>



<p>Good Luck!</p>
<p>The post <a href="https://sqlsolutionsgroup.com/removing-personally-identifiable-information/">Removing Personally Identifiable Information in Development Environments</a> appeared first on <a href="https://sqlsolutionsgroup.com">SQL Solutions Group</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://sqlsolutionsgroup.com/removing-personally-identifiable-information/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Removing Stubborn Partitions in SQL Server</title>
		<link>https://sqlsolutionsgroup.com/stubborn-partitions-in-sql-server/</link>
					<comments>https://sqlsolutionsgroup.com/stubborn-partitions-in-sql-server/#comments</comments>
		
		<dc:creator><![CDATA[Rich Benner]]></dc:creator>
		<pubDate>Fri, 11 Apr 2025 08:51:11 +0000</pubDate>
				<category><![CDATA[SQL Server]]></category>
		<guid isPermaLink="false">https://sqlsolutionsgroup.com/?p=7222</guid>

					<description><![CDATA[<p>What are stubborn partitions in SQL Server and how do you delete them?&#160;This was an interesting issue I recently had to deal with on a client site that I thought our readers might find interesting. The tables in use here are partitioned. The partition field is based upon a date field and we have a [&#8230;]</p>
<p>The post <a href="https://sqlsolutionsgroup.com/stubborn-partitions-in-sql-server/">Removing Stubborn Partitions in SQL Server</a> appeared first on <a href="https://sqlsolutionsgroup.com">SQL Solutions Group</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p>What are stubborn partitions in SQL Server and how do you delete them?&nbsp;This was an interesting issue I recently had to deal with on a client site that I thought our readers might find interesting.</p>



<p>The tables in use here are <a href="https://learn.microsoft.com/en-us/sql/relational-databases/partitions/partitioned-tables-and-indexes?view=sql-server-ver16">partitioned</a>. The partition field is based upon a date field and we have a partition per month. There is a monthly maintenance job which creates our new partitions. The job should also delete the oldest partitions. This job has been failing to delete an old partition as the data file contained within is not empty. It&#8217;s stubborn!</p>



<p>If we try to remove this file we get the error “The File cannot be removed because it is not empty,” as you can see:</p>



<figure class="wp-block-image"><img loading="lazy" decoding="async" width="437" height="86" src="https://sqlsolutionsgroup.com/wp-content/uploads/2025/04/word-image-7222-1.png" alt="Stubborn Partitions in SQL Server" class="wp-image-7223" srcset="https://sqlsolutionsgroup.com/wp-content/uploads/2025/04/word-image-7222-1.png 437w, https://sqlsolutionsgroup.com/wp-content/uploads/2025/04/word-image-7222-1-300x59.png 300w" sizes="(max-width: 437px) 100vw, 437px" /></figure>



<p>&nbsp;</p>



<p>This is the file in question (I removed file names):</p>



<figure class="wp-block-image"><img loading="lazy" decoding="async" width="1216" height="219" src="https://sqlsolutionsgroup.com/wp-content/uploads/2025/04/word-image-7222-2.png" alt="Stubborn Partitions in SQL Server" class="wp-image-7224" srcset="https://sqlsolutionsgroup.com/wp-content/uploads/2025/04/word-image-7222-2.png 1216w, https://sqlsolutionsgroup.com/wp-content/uploads/2025/04/word-image-7222-2-300x54.png 300w, https://sqlsolutionsgroup.com/wp-content/uploads/2025/04/word-image-7222-2-1024x184.png 1024w, https://sqlsolutionsgroup.com/wp-content/uploads/2025/04/word-image-7222-2-768x138.png 768w" sizes="(max-width: 1216px) 100vw, 1216px" /></figure>



<p>&nbsp;</p>



<p>We can use the T-SQL query below to find all objects that believe they exist within our partition.</p>


<div id="wpshdo_30" class="wp-synhighlighter-outer"><div id="wpshdt_30" class="wp-synhighlighter-expanded"><table border="0" width="100%"><tr><td align="left" width="80%"><a name="#codesyntax_30"></a><a id="wpshat_30" class="wp-synhighlighter-title" href="#codesyntax_30"  onClick="javascript:wpsh_toggleBlock(30)" title="Click to show/hide code block">Source code</a></td><td align="right"><a href="#codesyntax_30" onClick="javascript:wpsh_code(30)" title="Show code only"><img decoding="async" border="0" style="border: 0 none" src="https://sqlsolutionsgroup.com/wp-content/plugins/wp-synhighlight/themes/default/images/code.png" /></a>&nbsp;<a href="#codesyntax_30" onClick="javascript:wpsh_print(30)" title="Print code"><img decoding="async" border="0" style="border: 0 none" src="https://sqlsolutionsgroup.com/wp-content/plugins/wp-synhighlight/themes/default/images/printer.png" /></a>&nbsp;<a href="https://sqlsolutionsgroup.com/wp-content/plugins/wp-synhighlight/About.html" target="_blank" title="Show plugin information"><img decoding="async" border="0" style="border: 0 none" src="https://sqlsolutionsgroup.com/wp-content/plugins/wp-synhighlight/themes/default/images/info.gif" /></a>&nbsp;</td></tr></table></div><div id="wpshdi_30" class="wp-synhighlighter-inner" style="display: block;"><pre class="tsql" style="font-family:monospace;"><span class="kw1">SELECT</span>
&nbsp;
<span class="kw2">OBJECT_NAME</span><span class="br0">&#40;</span>p.<span class="kw2">OBJECT_ID</span><span class="br0">&#41;</span> <span class="kw1">AS</span> TableName
&nbsp;
,p.<span class="me1">partition_number</span> <span class="kw1">AS</span> PartitionNo
&nbsp;
,<span class="kw2">FILEGROUP_NAME</span><span class="br0">&#40;</span>a.<span class="me1">data_space_id</span><span class="br0">&#41;</span> <span class="kw1">AS</span> FileGroup
&nbsp;
,i.<span class="me1">name</span> <span class="kw1">AS</span> IndexName
&nbsp;
, <span class="sy0">*</span>
&nbsp;
<span class="kw1">FROM</span> sys.<span class="me1">allocation_units</span> a
&nbsp;
<span class="kw1">INNER</span> <span class="sy0">JOIN</span> sys.<span class="me1">partitions</span> p <span class="kw1">ON</span> a.<span class="me1">container_id</span> <span class="sy0">=</span> <span class="kw1">CASE</span> <span class="kw1">WHEN</span> a.<span class="me1">type</span> in<span class="br0">&#40;</span>1,3<span class="br0">&#41;</span> <span class="kw1">THEN</span> p.<span class="me1">hobt_id</span> <span class="kw1">ELSE</span> p.<span class="me1">partition_id</span> <span class="kw1">END</span> <span class="sy0">AND</span> p.<span class="kw2">OBJECT_ID</span> <span class="sy0">&gt;</span> 1024
&nbsp;
<span class="kw1">LEFT</span> <span class="sy0">JOIN</span> sys.<span class="me1">indexes</span> i <span class="kw1">ON</span> i.<span class="kw2">OBJECT_ID</span> <span class="sy0">=</span> p.<span class="kw2">OBJECT_ID</span> <span class="sy0">AND</span> i.<span class="me1">index_id</span> <span class="sy0">=</span> p.<span class="me1">index_id</span>
&nbsp;
<span class="kw1">WHERE</span> <span class="kw2">FILEGROUP_NAME</span><span class="br0">&#40;</span>a.<span class="me1">data_space_id</span><span class="br0">&#41;</span> <span class="sy0">=</span> <span class="st0">'FileGroupName'</span>
&nbsp;
<span class="kw1">ORDER</span> <span class="kw1">BY</span> FileGroup, TableName, p.<span class="me1">partition_number</span></pre></div></div>



<p> When run, you’ll get a list of all of the tables that believe they exist within this filegroup and how many data pages exist. </p>



<figure class="wp-block-image"><img loading="lazy" decoding="async" width="1412" height="236" src="https://sqlsolutionsgroup.com/wp-content/uploads/2025/04/a-screenshot-of-a-computer-ai-generated-content-m.png" alt="Stubborn Partitions in SQL Server" class="wp-image-7225" srcset="https://sqlsolutionsgroup.com/wp-content/uploads/2025/04/a-screenshot-of-a-computer-ai-generated-content-m.png 1412w, https://sqlsolutionsgroup.com/wp-content/uploads/2025/04/a-screenshot-of-a-computer-ai-generated-content-m-300x50.png 300w, https://sqlsolutionsgroup.com/wp-content/uploads/2025/04/a-screenshot-of-a-computer-ai-generated-content-m-1024x171.png 1024w, https://sqlsolutionsgroup.com/wp-content/uploads/2025/04/a-screenshot-of-a-computer-ai-generated-content-m-768x128.png 768w" sizes="(max-width: 1412px) 100vw, 1412px" /></figure>



<p>In our example, we have seven data pages that believe they exist in our partition. This is definitely a bug, because when we use our partition column and search our tables, we can see that no data exists.</p>



<p><div id="wpshdo_31" class="wp-synhighlighter-outer"><div id="wpshdt_31" class="wp-synhighlighter-expanded"><table border="0" width="100%"><tr><td align="left" width="80%"><a name="#codesyntax_31"></a><a id="wpshat_31" class="wp-synhighlighter-title" href="#codesyntax_31"  onClick="javascript:wpsh_toggleBlock(31)" title="Click to show/hide code block">Source code</a></td><td align="right"><a href="#codesyntax_31" onClick="javascript:wpsh_code(31)" title="Show code only"><img decoding="async" border="0" style="border: 0 none" src="https://sqlsolutionsgroup.com/wp-content/plugins/wp-synhighlight/themes/default/images/code.png" /></a>&nbsp;<a href="#codesyntax_31" onClick="javascript:wpsh_print(31)" title="Print code"><img decoding="async" border="0" style="border: 0 none" src="https://sqlsolutionsgroup.com/wp-content/plugins/wp-synhighlight/themes/default/images/printer.png" /></a>&nbsp;<a href="https://sqlsolutionsgroup.com/wp-content/plugins/wp-synhighlight/About.html" target="_blank" title="Show plugin information"><img decoding="async" border="0" style="border: 0 none" src="https://sqlsolutionsgroup.com/wp-content/plugins/wp-synhighlight/themes/default/images/info.gif" /></a>&nbsp;</td></tr></table></div><div id="wpshdi_31" class="wp-synhighlighter-inner" style="display: block;"><pre class="tsql" style="font-family:monospace;"><span class="kw1">SELECT</span> <span class="sy0">*</span> <span class="kw1">FROM</span> TableName <span class="kw1">WHERE</span> PartitionField <span class="sy0">BETWEEN</span> ‘StartDate’ <span class="sy0">AND</span> ‘EndDate’</pre></div></div></p>



<p>This is a bug in SQL Server and sensible human beings like us can&#8217;t resolve it. So, we’ll have to get <em>creative</em>.</p>



<h3 class="wp-block-heading">Getting Creative: The Nuclear Option</h3>



<p>From my experience, the only way to get rid of these rogue data pages is to truncate a table. By definition, truncating a table will deallocate all data pages associated with that table so we can get rid of these pesky hangers on. The big drawback is that you can’t put any sort of WHERE clause on a truncate, because you lose everything. It’s definitely the nuclear option when it comes to emptying out a table. We can’t do that to production tables in which we actually care about the data, obviously. We will have to perform a magic trick here to get this to work for us.</p>



<p>One of the great things about SQL Server partitioning is the ability to switch partitions between tables in the same filegroup. This consists of a metadata change only, rather than actually moving data.</p>



<p>Let’s combine both of these features to fix this pesky old filegroup.</p>



<p>From the first query above, we have our list of tables that are hanging around. For each of these we’re going to make a copy of the table structure (with a new name, something inventive like <em>TableName_PartitioningTemp)</em> along with all of the indexes that appear in our original table. We can then switch our partition over to the new table, truncate the new table, and then delete it (because we’re good children and tidy up after ourselves).</p>



<p>Our process will look like this:</p>



<ol class="wp-block-list">
<li>Create a copy of our table structure on the same partition</li>



<li>Create all indexes required</li>



<li>Switch our partition</li>



<li>Truncate our new table</li>



<li>Delete our new table</li>
</ol>



<p>To create a copy of our table, we’ll just let SQL Server do the hard work by right clicking on our table and scripting it to a new query editor window.</p>



<figure class="wp-block-image"><img loading="lazy" decoding="async" width="791" height="269" src="https://sqlsolutionsgroup.com/wp-content/uploads/2025/04/a-screenshot-of-a-computer-ai-generated-content-m-1.png" alt="Stubborn Partitions in SQL Server" class="wp-image-7226" srcset="https://sqlsolutionsgroup.com/wp-content/uploads/2025/04/a-screenshot-of-a-computer-ai-generated-content-m-1.png 791w, https://sqlsolutionsgroup.com/wp-content/uploads/2025/04/a-screenshot-of-a-computer-ai-generated-content-m-1-300x102.png 300w, https://sqlsolutionsgroup.com/wp-content/uploads/2025/04/a-screenshot-of-a-computer-ai-generated-content-m-1-768x261.png 768w" sizes="(max-width: 791px) 100vw, 791px" /></figure>



<p>One <strong>very important thing to note</strong> is that this will usually default to the PRIMARY filegroup. Be sure to change this to the correct filegroup:</p>



<figure class="wp-block-image"><img loading="lazy" decoding="async" width="391" height="150" src="https://sqlsolutionsgroup.com/wp-content/uploads/2025/04/a-computer-code-with-red-box-ai-generated-content.png" alt="A computer code with red box

AI-generated content may be incorrect." class="wp-image-7227" srcset="https://sqlsolutionsgroup.com/wp-content/uploads/2025/04/a-computer-code-with-red-box-ai-generated-content.png 391w, https://sqlsolutionsgroup.com/wp-content/uploads/2025/04/a-computer-code-with-red-box-ai-generated-content-300x115.png 300w" sizes="(max-width: 391px) 100vw, 391px" /></figure>



<p>We can then do the exact same and script out the necessary indexes. We’ll end up with a script looking something like this. <strong>REMEMBER</strong>, we’ll need to change the table name to something different than our live table.</p>



<figure class="wp-block-image"><img loading="lazy" decoding="async" width="744" height="191" src="https://sqlsolutionsgroup.com/wp-content/uploads/2025/04/a-computer-screen-shot-of-a-computer-code-ai-gene.png" alt="A computer screen shot of a computer code

AI-generated content may be incorrect." class="wp-image-7228" srcset="https://sqlsolutionsgroup.com/wp-content/uploads/2025/04/a-computer-screen-shot-of-a-computer-code-ai-gene.png 744w, https://sqlsolutionsgroup.com/wp-content/uploads/2025/04/a-computer-screen-shot-of-a-computer-code-ai-gene-300x77.png 300w" sizes="(max-width: 744px) 100vw, 744px" /></figure>



<p>This gives us our object ready to switch our partition into. Let’s do that by switching our partition to the new table. Make sure that your partition number is correct here.</p>



<figure class="wp-block-image"><img loading="lazy" decoding="async" width="570" height="31" src="https://sqlsolutionsgroup.com/wp-content/uploads/2025/04/word-image-7222-7.png" alt="" class="wp-image-7229" srcset="https://sqlsolutionsgroup.com/wp-content/uploads/2025/04/word-image-7222-7.png 570w, https://sqlsolutionsgroup.com/wp-content/uploads/2025/04/word-image-7222-7-300x16.png 300w" sizes="(max-width: 570px) 100vw, 570px" /></figure>



<p>Once this is done, we can then truncate our new _Partitioned table and delete it:</p>



<figure class="wp-block-image"><img loading="lazy" decoding="async" width="312" height="68" src="https://sqlsolutionsgroup.com/wp-content/uploads/2025/04/a-close-up-of-a-text-ai-generated-content-may-be.png" alt="A close-up of a text

AI-generated content may be incorrect." class="wp-image-7230" srcset="https://sqlsolutionsgroup.com/wp-content/uploads/2025/04/a-close-up-of-a-text-ai-generated-content-may-be.png 312w, https://sqlsolutionsgroup.com/wp-content/uploads/2025/04/a-close-up-of-a-text-ai-generated-content-may-be-300x65.png 300w" sizes="(max-width: 312px) 100vw, 312px" /></figure>



<p>Our final script will look something like this;</p>


<div id="wpshdo_32" class="wp-synhighlighter-outer"><div id="wpshdt_32" class="wp-synhighlighter-expanded"><table border="0" width="100%"><tr><td align="left" width="80%"><a name="#codesyntax_32"></a><a id="wpshat_32" class="wp-synhighlighter-title" href="#codesyntax_32"  onClick="javascript:wpsh_toggleBlock(32)" title="Click to show/hide code block">Source code</a></td><td align="right"><a href="#codesyntax_32" onClick="javascript:wpsh_code(32)" title="Show code only"><img decoding="async" border="0" style="border: 0 none" src="https://sqlsolutionsgroup.com/wp-content/plugins/wp-synhighlight/themes/default/images/code.png" /></a>&nbsp;<a href="#codesyntax_32" onClick="javascript:wpsh_print(32)" title="Print code"><img decoding="async" border="0" style="border: 0 none" src="https://sqlsolutionsgroup.com/wp-content/plugins/wp-synhighlight/themes/default/images/printer.png" /></a>&nbsp;<a href="https://sqlsolutionsgroup.com/wp-content/plugins/wp-synhighlight/About.html" target="_blank" title="Show plugin information"><img decoding="async" border="0" style="border: 0 none" src="https://sqlsolutionsgroup.com/wp-content/plugins/wp-synhighlight/themes/default/images/info.gif" /></a>&nbsp;</td></tr></table></div><div id="wpshdi_32" class="wp-synhighlighter-inner" style="display: block;"><pre class="tsql" style="font-family:monospace;"><span class="kw1">CREATE</span> <span class="kw1">TABLE</span> <span class="br0">[</span>dbo<span class="br0">]</span>.<span class="br0">[</span>Employees_Partitioned<span class="br0">]</span><span class="br0">&#40;</span>
&nbsp;
<span class="br0">[</span>EmployeeID<span class="br0">]</span> <span class="br0">[</span><span class="kw1">INT</span><span class="br0">]</span> <span class="kw1">IDENTITY</span><span class="br0">&#40;</span>1,1<span class="br0">&#41;</span> <span class="sy0">NOT</span> <span class="sy0">NULL</span>,
&nbsp;
<span class="br0">[</span>EmployeeName<span class="br0">]</span> <span class="br0">[</span><span class="kw1">VARCHAR</span><span class="br0">]</span><span class="br0">&#40;</span>100<span class="br0">&#41;</span> <span class="sy0">NULL</span>,
&nbsp;
<span class="br0">[</span>EmployeeAddress<span class="br0">]</span> <span class="br0">[</span><span class="kw1">VARCHAR</span><span class="br0">]</span><span class="br0">&#40;</span>100<span class="br0">&#41;</span> <span class="sy0">NULL</span>,
&nbsp;
<span class="br0">[</span>EmployeeDeptID<span class="br0">]</span> <span class="br0">[</span><span class="kw1">INT</span><span class="br0">]</span> <span class="sy0">NULL</span>
&nbsp;
<span class="br0">&#41;</span> <span class="kw1">ON</span> <span class="br0">[</span>NewFileGroup<span class="br0">]</span>
&nbsp;
GO
&nbsp;
<span class="kw1">CREATE</span> <span class="kw1">CLUSTERED</span> COLUMNST<span class="sy0">OR</span>E <span class="kw1">INDEX</span> <span class="br0">[</span>IX_CS_Employee<span class="br0">]</span> <span class="kw1">ON</span> <span class="br0">[</span>dbo<span class="br0">]</span>.<span class="br0">[</span>Employees_Partitioned<span class="br0">]</span>
&nbsp;
<span class="kw1">WITH</span> <span class="br0">&#40;</span>DROP_EXIST<span class="sy0">IN</span>G <span class="sy0">=</span> <span class="kw1">OFF</span>, COMPRESSION_DELAY <span class="sy0">=</span> 0<span class="br0">&#41;</span> <span class="kw1">ON</span> <span class="br0">[</span>NewFileGroup<span class="br0">]</span>
&nbsp;
GO
&nbsp;
<span class="kw1">ALTER</span> <span class="kw1">TABLE</span> <span class="br0">[</span>Employees<span class="br0">]</span> SWITCH PARTITION 1 <span class="kw1">TO</span> <span class="br0">[</span>Employees_Partitioned<span class="br0">]</span>
&nbsp;
<span class="kw1">TRUNCATE</span> <span class="kw1">TABLE</span> <span class="br0">[</span>Employees_Partitioned<span class="br0">]</span>
&nbsp;
<span class="kw1">DROP</span> <span class="kw1">TABLE</span> <span class="br0">[</span>Employees_Partitioned<span class="br0">]</span></pre></div></div>



<p>If you get any error messages, it may be that you’ve missed an index that’s required for the switch. Simply script it out and add it to your script.</p>



<p>Once you have completed this step, run the original script and you will remove this table from the list:</p>


<div id="wpshdo_33" class="wp-synhighlighter-outer"><div id="wpshdt_33" class="wp-synhighlighter-expanded"><table border="0" width="100%"><tr><td align="left" width="80%"><a name="#codesyntax_33"></a><a id="wpshat_33" class="wp-synhighlighter-title" href="#codesyntax_33"  onClick="javascript:wpsh_toggleBlock(33)" title="Click to show/hide code block">Source code</a></td><td align="right"><a href="#codesyntax_33" onClick="javascript:wpsh_code(33)" title="Show code only"><img decoding="async" border="0" style="border: 0 none" src="https://sqlsolutionsgroup.com/wp-content/plugins/wp-synhighlight/themes/default/images/code.png" /></a>&nbsp;<a href="#codesyntax_33" onClick="javascript:wpsh_print(33)" title="Print code"><img decoding="async" border="0" style="border: 0 none" src="https://sqlsolutionsgroup.com/wp-content/plugins/wp-synhighlight/themes/default/images/printer.png" /></a>&nbsp;<a href="https://sqlsolutionsgroup.com/wp-content/plugins/wp-synhighlight/About.html" target="_blank" title="Show plugin information"><img decoding="async" border="0" style="border: 0 none" src="https://sqlsolutionsgroup.com/wp-content/plugins/wp-synhighlight/themes/default/images/info.gif" /></a>&nbsp;</td></tr></table></div><div id="wpshdi_33" class="wp-synhighlighter-inner" style="display: block;"><pre class="tsql" style="font-family:monospace;"><span class="kw1">SELECT</span>
&nbsp;
<span class="kw2">OBJECT_NAME</span><span class="br0">&#40;</span>p.<span class="kw2">OBJECT_ID</span><span class="br0">&#41;</span> <span class="kw1">AS</span> TableName
&nbsp;
,p.<span class="me1">partition_number</span> <span class="kw1">AS</span> PartitionNo
&nbsp;
,<span class="kw2">FILEGROUP_NAME</span><span class="br0">&#40;</span>a.<span class="me1">data_space_id</span><span class="br0">&#41;</span> <span class="kw1">AS</span> FileGroup
&nbsp;
,i.<span class="me1">name</span> <span class="kw1">AS</span> IndexName
&nbsp;
, <span class="sy0">*</span>
&nbsp;
<span class="kw1">FROM</span> sys.<span class="me1">allocation_units</span> a
&nbsp;
<span class="kw1">INNER</span> <span class="sy0">JOIN</span> sys.<span class="me1">partitions</span> p <span class="kw1">ON</span> a.<span class="me1">container_id</span> <span class="sy0">=</span> <span class="kw1">CASE</span> <span class="kw1">WHEN</span> a.<span class="me1">type</span> in<span class="br0">&#40;</span>1,3<span class="br0">&#41;</span> <span class="kw1">THEN</span> p.<span class="me1">hobt_id</span> <span class="kw1">ELSE</span> p.<span class="me1">partition_id</span> <span class="kw1">END</span> <span class="sy0">AND</span> p.<span class="kw2">OBJECT_ID</span> <span class="sy0">&gt;</span> 1024
&nbsp;
<span class="kw1">LEFT</span> <span class="sy0">JOIN</span> sys.<span class="me1">indexes</span> i <span class="kw1">ON</span> i.<span class="kw2">OBJECT_ID</span> <span class="sy0">=</span> p.<span class="kw2">OBJECT_ID</span> <span class="sy0">AND</span> i.<span class="me1">index_id</span> <span class="sy0">=</span> p.<span class="me1">index_id</span>
&nbsp;
<span class="kw1">WHERE</span> <span class="kw2">FILEGROUP_NAME</span><span class="br0">&#40;</span>a.<span class="me1">data_space_id</span><span class="br0">&#41;</span> <span class="sy0">=</span> <span class="st0">'FileGroupName'</span>
&nbsp;
<span class="kw1">ORDER</span> <span class="kw1">BY</span> FileGroup, TableName, p.<span class="me1">partition_number</span></pre></div></div>



<p>If you have more than one table involved then you’ll have to do each one individually. Hopefully you don’t have too many, but this is definitely worth doing. Otherwise, you’ll never get rid of that filegroup.</p>



<p>Once the script runs and and the result of the script above is zero rows, you’re almost there. You need to check that the filegroup is not referenced by our partition scheme and function before we can finally delete it. We’d do this with a merge of the partition if it still exists.</p>



<p>ALTER PARTITION FUNCTION [FunctionName] () MERGE RANGE (N’2025-03-01’)</p>



<p>Then we can finally remove the file</p>



<p>ALTER DATABASE [DBName] REMOVE FILE [FileName]</p>



<p>That&#8217;s it! You&#8217;ve addressed stubborn partitions in SQL Server and removed what you don&#8217;t need.</p>



<p>&nbsp;</p>



<p>&nbsp;</p>
<p>The post <a href="https://sqlsolutionsgroup.com/stubborn-partitions-in-sql-server/">Removing Stubborn Partitions in SQL Server</a> appeared first on <a href="https://sqlsolutionsgroup.com">SQL Solutions Group</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://sqlsolutionsgroup.com/stubborn-partitions-in-sql-server/feed/</wfw:commentRss>
			<slash:comments>5</slash:comments>
		
		
			</item>
		<item>
		<title>SSMS Essential Settings</title>
		<link>https://sqlsolutionsgroup.com/ssms-essential-settings/</link>
					<comments>https://sqlsolutionsgroup.com/ssms-essential-settings/#comments</comments>
		
		<dc:creator><![CDATA[Rich Benner]]></dc:creator>
		<pubDate>Thu, 20 Mar 2025 11:11:48 +0000</pubDate>
				<category><![CDATA[SQL Server]]></category>
		<guid isPermaLink="false">https://sqlsolutionsgroup.com/?p=7199</guid>

					<description><![CDATA[<p>With the recent announcement by Microsoft that they’re removing Azure Data Studio alongside the release of the new 64-bit version of SQL Server Management Studio (SSMS), we’re back to SSMS being the de-facto tool for use with Microsoft SQL Server. Out of the box, SSMS (especially SSMS 21) is an excellent tool. It comes with a [&#8230;]</p>
<p>The post <a href="https://sqlsolutionsgroup.com/ssms-essential-settings/">SSMS Essential Settings</a> appeared first on <a href="https://sqlsolutionsgroup.com">SQL Solutions Group</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p>With the <a href="https://devblogs.microsoft.com/azure-sql/azure-data-studio-retirement/#:~:text=We're%20announcing%20the%20upcoming,developers%20ample%20time%20to%20transition.">recent announcement by Microsoft</a> that they’re removing Azure Data Studio alongside the release of the new 64-bit version of SQL Server Management Studio (SSMS), we’re back to SSMS being the de-facto tool for use with Microsoft SQL Server. Out of the box, SSMS (especially SSMS 21) is an excellent tool. It comes with a wealth of features and is the main way that most people interact with SQL Server (unless you’re one of those crazy PowerShell wizards). However, there’s a few things that you should know about SSMS essential settings to make your life just that little bit easier when working with this wonderful tool.</p>



<h3 class="wp-block-heading"><strong>Row Numbers</strong></h3>



<p>By default, SSMS does not show row numbers next to your code. That’s not a huge issue when working with smaller blocks of T-SQL. However, when working with larger problems and/or collaborating with colleagues, being able to refer to a row number is invaluable. This is especially important for us here at SQL Solutions Group when we’re in meetings and looking at code. Being able to refer to a line number on somebody else’s screen makes the world so much easier and less confusing.</p>



<p>By default, if you script out a stored procedure (this is sp_WhoIsActive) you’ll see something like this:</p>



<figure class="wp-block-image"><img loading="lazy" decoding="async" width="304" height="279" src="https://sqlsolutionsgroup.com/wp-content/uploads/2025/03/a-screenshot-of-a-computer-ai-generated-content-m.png" alt="A screenshot of a computer AI-generated content may be incorrect." class="wp-image-7200" srcset="https://sqlsolutionsgroup.com/wp-content/uploads/2025/03/a-screenshot-of-a-computer-ai-generated-content-m.png 304w, https://sqlsolutionsgroup.com/wp-content/uploads/2025/03/a-screenshot-of-a-computer-ai-generated-content-m-300x275.png 300w" sizes="(max-width: 304px) 100vw, 304px" /></figure>



<p></p>



<p>&nbsp;</p>



<p>Which is fine. However, when you turn on row numbers, you’ll see something like this:</p>



<figure class="wp-block-image"><img loading="lazy" decoding="async" width="592" height="443" src="https://sqlsolutionsgroup.com/wp-content/uploads/2025/03/a-screenshot-of-a-computer-ai-generated-content-m-1.png" alt="enabling row numbers is one of the SSMS essential settings." class="wp-image-7201" srcset="https://sqlsolutionsgroup.com/wp-content/uploads/2025/03/a-screenshot-of-a-computer-ai-generated-content-m-1.png 592w, https://sqlsolutionsgroup.com/wp-content/uploads/2025/03/a-screenshot-of-a-computer-ai-generated-content-m-1-300x224.png 300w" sizes="(max-width: 592px) 100vw, 592px" /></figure>



<p></p>



<p>&nbsp;</p>



<p>Which makes it <em><strong>much </strong></em>easier to read. To change this setting, go into <strong>Tools -&gt; Options -&gt; Text Editor -&gt; Transact-SQL</strong> and enable Line Numbers:</p>



<figure class="wp-block-image"><img loading="lazy" decoding="async" width="740" height="433" src="https://sqlsolutionsgroup.com/wp-content/uploads/2025/03/a-screenshot-of-a-computer-ai-generated-content-m-2.png" alt="A screenshot of a computer AI-generated content may be incorrect." class="wp-image-7202" srcset="https://sqlsolutionsgroup.com/wp-content/uploads/2025/03/a-screenshot-of-a-computer-ai-generated-content-m-2.png 740w, https://sqlsolutionsgroup.com/wp-content/uploads/2025/03/a-screenshot-of-a-computer-ai-generated-content-m-2-300x176.png 300w" sizes="(max-width: 740px) 100vw, 740px" /></figure>



<p></p>



<h3 class="wp-block-heading">&nbsp;</h3>



<h3 class="wp-block-heading"><strong>Scroll Bar</strong></h3>



<p>By default in most versions of SSMS, the scroll bar is just a scroll bar. It looks something like this:</p>



<figure class="wp-block-image"><img loading="lazy" decoding="async" width="99" height="294" src="https://sqlsolutionsgroup.com/wp-content/uploads/2025/03/a-blue-and-gold-striped-border-ai-generated-conte.png" alt="A blue and gold striped border AI-generated content may be incorrect." class="wp-image-7203"/></figure>



<p></p>



<p>&nbsp;</p>



<p>That&#8217;s OK, it does its job. However, if you’re working with a larger procedure it’s not actually very useful. Instead, enabling map mode for your scroll bar will give you something like this:</p>



<figure class="wp-block-image"><img loading="lazy" decoding="async" width="105" height="465" src="https://sqlsolutionsgroup.com/wp-content/uploads/2025/03/a-blurry-image-of-a-computer-screen-ai-generated.png" alt="Map mode for the scroll bar is an SSMS essential setting that makes it easy to navigate your project" class="wp-image-7204" srcset="https://sqlsolutionsgroup.com/wp-content/uploads/2025/03/a-blurry-image-of-a-computer-screen-ai-generated.png 105w, https://sqlsolutionsgroup.com/wp-content/uploads/2025/03/a-blurry-image-of-a-computer-screen-ai-generated-68x300.png 68w" sizes="(max-width: 105px) 100vw, 105px" /></figure>



<p></p>



<p>&nbsp;</p>



<p>Which, when you’re moving around your code, gives you much more control on where you’re going or want to go. The setting for this is also in <strong>Tools -&gt; Options</strong> and can be found in the menu below:</p>



<figure class="wp-block-image"><img loading="lazy" decoding="async" width="739" height="430" src="https://sqlsolutionsgroup.com/wp-content/uploads/2025/03/a-screenshot-of-a-computer-ai-generated-content-m-3.png" alt="A screenshot of a computer AI-generated content may be incorrect." class="wp-image-7205" srcset="https://sqlsolutionsgroup.com/wp-content/uploads/2025/03/a-screenshot-of-a-computer-ai-generated-content-m-3.png 739w, https://sqlsolutionsgroup.com/wp-content/uploads/2025/03/a-screenshot-of-a-computer-ai-generated-content-m-3-300x175.png 300w" sizes="(max-width: 739px) 100vw, 739px" /></figure>



<p></p>



<p>&nbsp;</p>



<p>There are a few different options for source overview, so have a play and see which ones you prefer.</p>



<h3 class="wp-block-heading"><strong>Tab Management</strong></h3>



<p>One of the most frustrating things when working in SSMS is losing the tab you were looking for. They’re never where you expect them, and finding that one tab is always a nightmare. You can already pin tabs; however, it doesn’t take long to run out of screen real estate.</p>



<p>One trick you can do is to pin tabs to a separate row. This separates them from the noise and makes them much easier to find.</p>



<p>The first tab here is pinned, but it doesn’t really stick out vs the rest of the tabs</p>



<figure class="wp-block-image"><img loading="lazy" decoding="async" width="1070" height="47" src="https://sqlsolutionsgroup.com/wp-content/uploads/2025/03/word-image-7199-7.png" alt="" class="wp-image-7206" srcset="https://sqlsolutionsgroup.com/wp-content/uploads/2025/03/word-image-7199-7.png 1070w, https://sqlsolutionsgroup.com/wp-content/uploads/2025/03/word-image-7199-7-300x13.png 300w, https://sqlsolutionsgroup.com/wp-content/uploads/2025/03/word-image-7199-7-1024x45.png 1024w, https://sqlsolutionsgroup.com/wp-content/uploads/2025/03/word-image-7199-7-768x34.png 768w" sizes="(max-width: 1070px) 100vw, 1070px" /></figure>



<p></p>



<p>&nbsp;</p>



<p>Whereas, there’s a handy little setting to <strong>show pinned tabs on a separate row</strong>, which looks something like this:</p>



<figure class="wp-block-image"><img loading="lazy" decoding="async" width="880" height="74" src="https://sqlsolutionsgroup.com/wp-content/uploads/2025/03/word-image-7199-8.png" alt="Want pinned tabs in a separate row? That's easy with SSMS essential settings. " class="wp-image-7207" srcset="https://sqlsolutionsgroup.com/wp-content/uploads/2025/03/word-image-7199-8.png 880w, https://sqlsolutionsgroup.com/wp-content/uploads/2025/03/word-image-7199-8-300x25.png 300w, https://sqlsolutionsgroup.com/wp-content/uploads/2025/03/word-image-7199-8-768x65.png 768w" sizes="(max-width: 880px) 100vw, 880px" /></figure>



<p></p>



<p>&nbsp;</p>



<p>This can be found (surprise, surprise) in <strong>Tools -&gt; Options</strong>:</p>



<figure class="wp-block-image"><img loading="lazy" decoding="async" width="743" height="436" src="https://sqlsolutionsgroup.com/wp-content/uploads/2025/03/a-screenshot-of-a-computer-ai-generated-content-m-4.png" alt="A screenshot of a computer AI-generated content may be incorrect." class="wp-image-7208" srcset="https://sqlsolutionsgroup.com/wp-content/uploads/2025/03/a-screenshot-of-a-computer-ai-generated-content-m-4.png 743w, https://sqlsolutionsgroup.com/wp-content/uploads/2025/03/a-screenshot-of-a-computer-ai-generated-content-m-4-300x176.png 300w" sizes="(max-width: 743px) 100vw, 743px" /></figure>



<p></p>



<p>&nbsp;</p>



<p>A very helpful feature that’s new in SSMS 21 is the ability to show multiple rows of tabs at once. This is great because rather than dealing with that damned menu to select your tabs &#8230;</p>



<figure class="wp-block-image"><img loading="lazy" decoding="async" width="461" height="214" src="https://sqlsolutionsgroup.com/wp-content/uploads/2025/03/a-screenshot-of-a-computer-ai-generated-content-m-5.png" alt="A screenshot of a computer AI-generated content may be incorrect." class="wp-image-7209" srcset="https://sqlsolutionsgroup.com/wp-content/uploads/2025/03/a-screenshot-of-a-computer-ai-generated-content-m-5.png 461w, https://sqlsolutionsgroup.com/wp-content/uploads/2025/03/a-screenshot-of-a-computer-ai-generated-content-m-5-300x139.png 300w" sizes="(max-width: 461px) 100vw, 461px" /></figure>



<p></p>



<p>&nbsp;</p>



<p>&#8230; you can see them all at once, which ends up looking something like this:</p>



<figure class="wp-block-image"><img loading="lazy" decoding="async" width="1472" height="105" src="https://sqlsolutionsgroup.com/wp-content/uploads/2025/03/word-image-7199-11.png" alt="" class="wp-image-7210" srcset="https://sqlsolutionsgroup.com/wp-content/uploads/2025/03/word-image-7199-11.png 1472w, https://sqlsolutionsgroup.com/wp-content/uploads/2025/03/word-image-7199-11-300x21.png 300w, https://sqlsolutionsgroup.com/wp-content/uploads/2025/03/word-image-7199-11-1024x73.png 1024w, https://sqlsolutionsgroup.com/wp-content/uploads/2025/03/word-image-7199-11-768x55.png 768w" sizes="(max-width: 1472px) 100vw, 1472px" /></figure>



<p></p>



<p>&nbsp;</p>



<p>In <strong>Tools -&gt; Options,</strong> you’ll want this setting;</p>



<figure class="wp-block-image"><img loading="lazy" decoding="async" width="747" height="436" src="https://sqlsolutionsgroup.com/wp-content/uploads/2025/03/a-screenshot-of-a-computer-ai-generated-content-m-6.png" alt="A screenshot of a computer AI-generated content may be incorrect." class="wp-image-7211" srcset="https://sqlsolutionsgroup.com/wp-content/uploads/2025/03/a-screenshot-of-a-computer-ai-generated-content-m-6.png 747w, https://sqlsolutionsgroup.com/wp-content/uploads/2025/03/a-screenshot-of-a-computer-ai-generated-content-m-6-300x175.png 300w" sizes="(max-width: 747px) 100vw, 747px" /></figure>



<p></p>



<h3 class="wp-block-heading">&nbsp;</h3>



<h3 class="wp-block-heading"><strong>Vertical Tabs</strong></h3>



<p>This is another feature that’s new in SSMS 21, but we now have the choice where our tabs are located. We have the traditional Top as an option, but we can now have them on the left or the right of our screen.</p>



<p>Here’s an example of me snapping my tabs to the right of the screen:</p>



<figure class="wp-block-image"><img loading="lazy" decoding="async" width="377" height="532" src="https://sqlsolutionsgroup.com/wp-content/uploads/2025/03/a-screenshot-of-a-computer-program-ai-generated-c.png" alt="This SSMS essential setting enables you to move tabs to the right or left of your screen" class="wp-image-7212" srcset="https://sqlsolutionsgroup.com/wp-content/uploads/2025/03/a-screenshot-of-a-computer-program-ai-generated-c.png 377w, https://sqlsolutionsgroup.com/wp-content/uploads/2025/03/a-screenshot-of-a-computer-program-ai-generated-c-213x300.png 213w" sizes="(max-width: 377px) 100vw, 377px" /></figure>



<p></p>



<p>&nbsp;</p>



<p>This is likely to take a while to get used to but, it’s enormously beneficial when dealing with an investigation or similar task where multiple tabs are just an unavoidable fact of life.</p>



<p>One feature I like in particular here is that pinned tabs persist when used with the ‘show pinned tabs in a separate row’ setting and stay in their own section at the top of the screen.</p>



<p>Yep &#8230; find it in <strong>Tools -&gt; Options</strong>:</p>



<figure class="wp-block-image"><img loading="lazy" decoding="async" width="743" height="430" src="https://sqlsolutionsgroup.com/wp-content/uploads/2025/03/a-screenshot-of-a-computer-ai-generated-content-m-7.png" alt="A screenshot of a computer AI-generated content may be incorrect." class="wp-image-7213" srcset="https://sqlsolutionsgroup.com/wp-content/uploads/2025/03/a-screenshot-of-a-computer-ai-generated-content-m-7.png 743w, https://sqlsolutionsgroup.com/wp-content/uploads/2025/03/a-screenshot-of-a-computer-ai-generated-content-m-7-300x174.png 300w" sizes="(max-width: 743px) 100vw, 743px" /></figure>



<p></p>



<h3 class="wp-block-heading">&nbsp;</h3>



<h3 class="wp-block-heading"><strong>Themes</strong></h3>



<p>Last, but not least, we now have themes available in SSMS. This is both much nicer on the eyes (hello, dark mode) but also gives a lot of accessibility options.</p>



<p>Themes have their own menu in Tools:</p>



<figure class="wp-block-image"><img loading="lazy" decoding="async" width="578" height="343" src="https://sqlsolutionsgroup.com/wp-content/uploads/2025/03/a-screenshot-of-a-computer-ai-generated-content-m-8.png" alt="A screenshot of a computer AI-generated content may be incorrect." class="wp-image-7214" srcset="https://sqlsolutionsgroup.com/wp-content/uploads/2025/03/a-screenshot-of-a-computer-ai-generated-content-m-8.png 578w, https://sqlsolutionsgroup.com/wp-content/uploads/2025/03/a-screenshot-of-a-computer-ai-generated-content-m-8-300x178.png 300w" sizes="(max-width: 578px) 100vw, 578px" /></figure>



<p></p>



<p>&nbsp;</p>



<p>The dark theme is a particular favourite and, I suspect, going to be very popular:</p>



<figure class="wp-block-image"><img loading="lazy" decoding="async" width="952" height="427" src="https://sqlsolutionsgroup.com/wp-content/uploads/2025/03/a-screenshot-of-a-computer-program-ai-generated-c-1.png" alt="The dark theme is one of the SSMS essential settings that is easy on the eyes." class="wp-image-7215" srcset="https://sqlsolutionsgroup.com/wp-content/uploads/2025/03/a-screenshot-of-a-computer-program-ai-generated-c-1.png 952w, https://sqlsolutionsgroup.com/wp-content/uploads/2025/03/a-screenshot-of-a-computer-program-ai-generated-c-1-300x135.png 300w, https://sqlsolutionsgroup.com/wp-content/uploads/2025/03/a-screenshot-of-a-computer-program-ai-generated-c-1-768x344.png 768w" sizes="(max-width: 952px) 100vw, 952px" /></figure>



<p></p>



<p>&nbsp;</p>



<p>There’s also a bunch of Accessibility choices in <strong>Tools -&gt; Options</strong> where you can customize fonts and so you can set it exactly how you need/want.</p>



<figure class="wp-block-image"><img loading="lazy" decoding="async" width="743" height="432" src="https://sqlsolutionsgroup.com/wp-content/uploads/2025/03/a-screenshot-of-a-computer-ai-generated-content-m-9.png" alt="A screenshot of a computer AI-generated content may be incorrect." class="wp-image-7216" srcset="https://sqlsolutionsgroup.com/wp-content/uploads/2025/03/a-screenshot-of-a-computer-ai-generated-content-m-9.png 743w, https://sqlsolutionsgroup.com/wp-content/uploads/2025/03/a-screenshot-of-a-computer-ai-generated-content-m-9-300x174.png 300w" sizes="(max-width: 743px) 100vw, 743px" /></figure>



<p>&nbsp;</p>



<p>Now go have fun with these SSMS essential settings, you crazy cat!</p>



<p>&nbsp;</p>
<p>The post <a href="https://sqlsolutionsgroup.com/ssms-essential-settings/">SSMS Essential Settings</a> appeared first on <a href="https://sqlsolutionsgroup.com">SQL Solutions Group</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://sqlsolutionsgroup.com/ssms-essential-settings/feed/</wfw:commentRss>
			<slash:comments>1</slash:comments>
		
		
			</item>
		<item>
		<title>Exploring SSMS 21</title>
		<link>https://sqlsolutionsgroup.com/exploring-ssms-21/</link>
					<comments>https://sqlsolutionsgroup.com/exploring-ssms-21/#respond</comments>
		
		<dc:creator><![CDATA[Rich Benner]]></dc:creator>
		<pubDate>Wed, 08 Jan 2025 08:27:01 +0000</pubDate>
				<category><![CDATA[SQL Server]]></category>
		<guid isPermaLink="false">https://sqlsolutionsgroup.com/?p=7157</guid>

					<description><![CDATA[<p>Microsoft recently announced SQL Server Management Studio (SSMS 21). Here's a quick look at what's included in this latest iteration.</p>
<p>The post <a href="https://sqlsolutionsgroup.com/exploring-ssms-21/">Exploring SSMS 21</a> appeared first on <a href="https://sqlsolutionsgroup.com">SQL Solutions Group</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p>At the 2024 PASS Data Community Summit, Microsoft announced SQL Server Management Studio (SSMS 21). As of the writing this blog post, it’s still in Public Preview so it’s not something we’d recommend deploying to a production environment, but let’s see where it’s at now.</p>



<h3 class="wp-block-heading"><strong>What’s New in SSMS 21?</strong></h3>



<h4 class="wp-block-heading"><strong>1. 64-bit compatibility</strong></h4>



<p>This one is huge. SSMS has always been a 32-bit application, which can cause all sorts of issues from general slowness to out of memory exceptions. SSMS 21 is now based on a Visual Studio shell. This means that it’s fully 64-bit compatible and gets some funky new features like different accessibility modes (hello dark mode), as well as all the other improvements you’d expect from a modern 64-bit application.</p>



<p>Doesn’t this look funky?</p>



<figure class="wp-block-image"><img loading="lazy" decoding="async" width="676" height="413" src="https://sqlsolutionsgroup.com/wp-content/uploads/2024/12/a-blue-and-white-background-with-white-text-descr.png" alt="SSMS 21 is currently in public preview." class="wp-image-7144" srcset="https://sqlsolutionsgroup.com/wp-content/uploads/2024/12/a-blue-and-white-background-with-white-text-descr.png 676w, https://sqlsolutionsgroup.com/wp-content/uploads/2024/12/a-blue-and-white-background-with-white-text-descr-300x183.png 300w" sizes="(max-width: 676px) 100vw, 676px" /></figure>



<p></p>



<h4 class="wp-block-heading"><strong>2. Code and feature search</strong></h4>



<p>Along with the interface makeover, we’ve now got code and feature search capabilities. This gives us a native way to find the code we care about as well as searching and enabling the new features baked into SSMS.</p>



<p>Want to know more about Git integration? Hit the search icon and go to feature search.</p>



<figure class="wp-block-image"><img loading="lazy" decoding="async" width="657" height="92" src="https://sqlsolutionsgroup.com/wp-content/uploads/2024/12/a-screenshot-of-a-computer-description-automatica.png" alt="A screenshot of a computer

Description automatically generated" class="wp-image-7145" srcset="https://sqlsolutionsgroup.com/wp-content/uploads/2024/12/a-screenshot-of-a-computer-description-automatica.png 657w, https://sqlsolutionsgroup.com/wp-content/uploads/2024/12/a-screenshot-of-a-computer-description-automatica-300x42.png 300w" sizes="(max-width: 657px) 100vw, 657px" /></figure>



<p></p>



<p>Type “Git” and you’ll see several settings pages as well as some handy how-to guides for these features.</p>



<figure class="wp-block-image"><img loading="lazy" decoding="async" width="577" height="416" src="https://sqlsolutionsgroup.com/wp-content/uploads/2024/12/a-screenshot-of-a-computer-description-automatica-1.png" alt="Feature search in SSMS 21 is a handy new feature we're excited about. " class="wp-image-7146" srcset="https://sqlsolutionsgroup.com/wp-content/uploads/2024/12/a-screenshot-of-a-computer-description-automatica-1.png 577w, https://sqlsolutionsgroup.com/wp-content/uploads/2024/12/a-screenshot-of-a-computer-description-automatica-1-300x216.png 300w" sizes="(max-width: 577px) 100vw, 577px" /></figure>



<p></p>



<p>This is excellent for newer users finding out features as well as us old people who can never remember which menu something is buried in!</p>



<h4 class="wp-block-heading"><strong>3. Copilot/AI</strong></h4>



<p>This was the part of the product that Microsoft were most excited about in the PASS Summit keynote. We were shown a number of features, including inbuilt Copilot as well as native support for Vector data types and integration with various AI products.</p>



<p>Unfortunately, I can’t show you these features as they’re not currently included in the public preview, but when it’s available we’ll take a deep dive into it.</p>



<figure class="wp-block-image"><img loading="lazy" decoding="async" width="430" height="80" src="https://sqlsolutionsgroup.com/wp-content/uploads/2024/12/a-black-background-with-white-text-description-au.png" alt="SSMS 21 is currently in public preview." class="wp-image-7147" srcset="https://sqlsolutionsgroup.com/wp-content/uploads/2024/12/a-black-background-with-white-text-description-au.png 430w, https://sqlsolutionsgroup.com/wp-content/uploads/2024/12/a-black-background-with-white-text-description-au-300x56.png 300w" sizes="(max-width: 430px) 100vw, 430px" /></figure>



<p></p>



<h4 class="wp-block-heading"><strong>4. Query Store Enhancements</strong></h4>



<p>The main new feature for me here is the addition of the replica drop down in the query store reports. This allows you to read data from the various replicas you may have in your environment.</p>



<figure class="wp-block-image"><img loading="lazy" decoding="async" width="371" height="120" src="https://sqlsolutionsgroup.com/wp-content/uploads/2024/12/a-screenshot-of-a-computer-description-automatica-2.png" alt="A screenshot of a computer

Description automatically generated" class="wp-image-7148" srcset="https://sqlsolutionsgroup.com/wp-content/uploads/2024/12/a-screenshot-of-a-computer-description-automatica-2.png 371w, https://sqlsolutionsgroup.com/wp-content/uploads/2024/12/a-screenshot-of-a-computer-description-automatica-2-300x97.png 300w" sizes="(max-width: 371px) 100vw, 371px" /></figure>



<p></p>



<p>This goes hand in hand with the upcoming feature of running a separate <a href="https://learn.microsoft.com/en-us/sql/relational-databases/performance/query-store-for-secondary-replicas?view=sql-server-ver16">Query Store on secondary replicas</a>. Which is going to be great for people who offload read queries onto their secondaries but would like to be able to do funky stuff like forcing plans on the secondary only. Really looking forward to this feature.</p>



<h4 class="wp-block-heading"><strong>4. Improved Performance Dashboard</strong></h4>



<p>The performance dashboard has been around for a while, and I suspect it’s not a highly used feature. It gives some basic information about server performance as well as the ability to drill down into it. I would bet that most people are using external tools to monitor their servers, but for situations where this isn’t available, I’d definitely get used to using this.</p>



<figure class="wp-block-image"><img loading="lazy" decoding="async" width="999" height="766" src="https://sqlsolutionsgroup.com/wp-content/uploads/2024/12/a-screenshot-of-a-computer-description-automatica-3.png" alt="A screenshot of a computer

Description automatically generated" class="wp-image-7149" srcset="https://sqlsolutionsgroup.com/wp-content/uploads/2024/12/a-screenshot-of-a-computer-description-automatica-3.png 999w, https://sqlsolutionsgroup.com/wp-content/uploads/2024/12/a-screenshot-of-a-computer-description-automatica-3-300x230.png 300w, https://sqlsolutionsgroup.com/wp-content/uploads/2024/12/a-screenshot-of-a-computer-description-automatica-3-768x589.png 768w" sizes="(max-width: 999px) 100vw, 999px" /></figure>



<p></p>



<h4 class="wp-block-heading"><strong>How to Get Started</strong></h4>



<p>As SSMS is in public preview, you can download it from <a href="https://learn.microsoft.com/en-us/sql/ssms/install/install?view=sql-server-ver16">Microsoft directly</a>. Remember that this is still in preview, so go have fun, but beware it can be buggy (I’ve personally had issues with the search being a little flaky). Keep it away from production environments!</p>



<p>Don’t let me stop you though. Go have fun and dig in, learn by doing and see if you can find some fun new features that we haven’t covered here!</p>
<p>The post <a href="https://sqlsolutionsgroup.com/exploring-ssms-21/">Exploring SSMS 21</a> appeared first on <a href="https://sqlsolutionsgroup.com">SQL Solutions Group</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://sqlsolutionsgroup.com/exploring-ssms-21/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
