<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Schema Audit on SQL Server Scripts</title><link>https://www.sqlserver70.com/tags/schema-audit/</link><description>Recent content in Schema Audit on SQL Server Scripts</description><generator>Hugo -- gohugo.io</generator><language>en</language><copyright>SQLServer70.com</copyright><lastBuildDate>Thu, 16 Apr 2026 00:00:00 +0000</lastBuildDate><atom:link href="https://www.sqlserver70.com/tags/schema-audit/index.xml" rel="self" type="application/rss+xml"/><item><title>SQL Server: Find Tables Without Primary Keys</title><link>https://www.sqlserver70.com/post/sql-server-find-tables-without-primary-keys/</link><pubDate>Thu, 16 Apr 2026 00:00:00 +0000</pubDate><guid>https://www.sqlserver70.com/post/sql-server-find-tables-without-primary-keys/</guid><description>
&lt;p&gt;Tables without primary keys are heap structures with no guaranteed row ordering and no unique row identifier. They cause full table scans in queries that could use seeks, slow down DELETE and UPDATE operations, and are incompatible with SQL Server replication and Change Data Capture. This script finds every user table in the current database that has no primary key defined.&lt;/p&gt;
&lt;script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-1012089347386563"
crossorigin="anonymous"&gt;&lt;/script&gt;
&lt;ins class="adsbygoogle"
style="display:inline-block;width:728px;height:90px"
data-ad-client="ca-pub-1012089347386563"
data-ad-slot="8593449130"&gt;&lt;/ins&gt;
&lt;script&gt;
(adsbygoogle = window.adsbygoogle || []).push({});
&lt;/script&gt;
&lt;h2 id="purpose-and-overview"&gt;Purpose and Overview&lt;/h2&gt;
&lt;p&gt;A primary key enforces uniqueness on a column or set of columns and, by default, creates a clustered index that physically orders the table rows. Without a primary key, SQL Server stores rows in a heap: an unordered structure where updates and deletes must first locate rows through a full scan or a nonclustered index lookup followed by a separate heap RID lookup.&lt;/p&gt;</description></item></channel></rss>