<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Cross Database on SQL Server Scripts</title><link>https://www.sqlserver70.com/tags/cross-database/</link><description>Recent content in Cross Database on SQL Server Scripts</description><generator>Hugo -- gohugo.io</generator><language>en</language><copyright>SQLServer70.com</copyright><lastBuildDate>Mon, 29 Jun 2026 00:00:00 +0000</lastBuildDate><atom:link href="https://www.sqlserver70.com/tags/cross-database/index.xml" rel="self" type="application/rss+xml"/><item><title>List All Tables Across All Databases in SQL Server</title><link>https://www.sqlserver70.com/post/list-all-tables-across-all-databases-in-sql-server/</link><pubDate>Mon, 29 Jun 2026 00:00:00 +0000</pubDate><guid>https://www.sqlserver70.com/post/list-all-tables-across-all-databases-in-sql-server/</guid><description>
&lt;p&gt;A cross-database table inventory is one of the most common ad hoc requests in any SQL Server environment — and one of the few queries that cannot be answered by staying inside a single database context. &lt;code&gt;sys.databases&lt;/code&gt; exposes every online database on the instance; three-part name references to &lt;code&gt;sys.tables&lt;/code&gt; inside dynamic SQL pull the user-table list from each one. The script below accumulates results in a temp table and returns them sorted by database, schema, and table name, with a second variant that narrows results to a specific table name for cross-database search.&lt;/p&gt;</description></item></channel></rss>