sp_msforeachdb

SQLServerCentral Article

sp_msforeachdb: Improving on an Undocumented Stored Procedure

  • Article

Have you ever wanted to run a query across every database on a server with the convenience of a stored procedure? If so, Microsoft provided a stored procedure to do so. It’s unreliable, outdated, and somewhat obfuscated, though. Let’s improve on it!

★ ★ ★ ★ ★ ★ ★ ★ ★ ★

(43)

You rated this post out of 5. Change rating

2016-04-15 (first published: )

17,129 reads

Blogs

Fighting Procrastination?

By

Here is another short video (~ 15 minutes). This is by the author of...

A Fun Prize at the PASS Data Community Summit

By

I had a briefing for the 2026 PASS Data Community Summit, which is just...

How to Measure AI Value: A 6-Branch AI Maturity Model for Use Cases and Agents

By

Your AI is busy. But do you know what it's worth? Most companies can...

Read the latest Blogs

Forums

Alamat Telp BCA KCP Jamblang +62 838-4945-0961

By m4l4mt194

Wa:083849450961 Jl. Jamblang Raya No.51, RT.2/RW.1, Duri Sel., Kec. Tambora, Kota Jakarta Barat, Daerah...

Telp BCA KCP Mandala Raya +62 838-4945-0961

By Halo_BCA

Wa:083849450961 Jl. Mandala Raya No.14, RT.13/RW.5, Tomang, Kec. Grogol petamburan, Kota Jakarta Barat, Daerah...

SQL Server 2025 Server-level Roles

By Steve Jones - SSC Editor

Comments posted to this topic are about the item SQL Server 2025 Server-level Roles

Visit the forum

Question of the Day

SQL Server 2025 Server-level Roles

In SQL Server 2022+, what does the ##MS_DatabaseConnector## role allow?

See possible answers