<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Information_schema on SQL Server Scripts</title><link>https://www.sqlserver70.com/tags/information_schema/</link><description>Recent content in Information_schema on SQL Server Scripts</description><generator>Hugo -- gohugo.io</generator><language>en</language><copyright>SQLServer70.com</copyright><lastBuildDate>Thu, 18 Jun 2026 00:00:00 +0000</lastBuildDate><atom:link href="https://www.sqlserver70.com/tags/information_schema/index.xml" rel="self" type="application/rss+xml"/><item><title>SQL Server Database Schema and Data Dictionary Queries</title><link>https://www.sqlserver70.com/post/sql-server-database-schema-data-dictionary-queries/</link><pubDate>Thu, 18 Jun 2026 00:00:00 +0000</pubDate><guid>https://www.sqlserver70.com/post/sql-server-database-schema-data-dictionary-queries/</guid><description>
&lt;p&gt;Documenting a database starts with a data dictionary: every table, every column, its data type, length, nullability, and default. SQL Server exposes this through the ANSI-standard &lt;code&gt;INFORMATION_SCHEMA&lt;/code&gt; views, which produce a portable schema report that reads almost like English and runs unchanged on other ISO-compliant database engines.&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;&lt;code&gt;INFORMATION_SCHEMA&lt;/code&gt; is a set of views defined by the ISO SQL standard and implemented in a special schema present in every SQL Server database. Their purpose is insulation: they present an internal, system-table-independent view of metadata, so applications keep working even when the underlying system tables change between releases. That portability is the main reason to reach for them — a data-dictionary query written against &lt;code&gt;INFORMATION_SCHEMA&lt;/code&gt; will run on SQL Server, PostgreSQL, MySQL, and other engines that implement the standard.&lt;/p&gt;</description></item><item><title>sp_pkeys and Primary Key Metadata in SQL Server</title><link>https://www.sqlserver70.com/post/sql-server-sp-pkeys-primary-key-metadata/</link><pubDate>Tue, 16 Jun 2026 00:00:00 +0000</pubDate><guid>https://www.sqlserver70.com/post/sql-server-sp-pkeys-primary-key-metadata/</guid><description>
&lt;p&gt;Which columns make up a table's primary key, and in what order are they declared? For a single table, the system stored procedure &lt;code&gt;sp_pkeys&lt;/code&gt; answers in one line; for a database-wide inventory, the catalog views behind it give you full control. This post covers both, from the quick lookup to the complete metadata query.&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;&lt;code&gt;sp_pkeys&lt;/code&gt; returns primary key information for one table in the current database. It is an ODBC-catalog procedure — the T-SQL equivalent of the &lt;code&gt;SQLPrimaryKeys&lt;/code&gt; ODBC function — and its result set is deliberately compact: &lt;code&gt;TABLE_QUALIFIER&lt;/code&gt;, &lt;code&gt;TABLE_OWNER&lt;/code&gt;, &lt;code&gt;TABLE_NAME&lt;/code&gt;, &lt;code&gt;COLUMN_NAME&lt;/code&gt;, &lt;code&gt;KEY_SEQ&lt;/code&gt;, and &lt;code&gt;PK_NAME&lt;/code&gt;. The &lt;code&gt;KEY_SEQ&lt;/code&gt; column is the one that matters most: it gives the sequence number of each column within a multicolumn primary key, so a composite key returns one row per column in declared order.&lt;/p&gt;</description></item></channel></rss>