sp_msforeachdb: Improving on an Undocumented Stored Procedure

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!

4.72 (43)

2016-04-15 (first published: )

14,839 reads

Database Design Follies: NULL vs. NOT NULL

It sounds simple enough. Either your column will always have a value or it may not. Yet somehow such a seemingly simple decision can become a never-ending debate where database schema begins to resemble superstition and designing effective tables seems more contentious than you expected it to be.

4.38 (78)

2016-02-26 (first published: )

22,731 reads

Blogs

Basic XML Queries–#SQLNewBlogger

By

Another post for me that is simple and hopefully serves as an example for...

Don’t Stop at Just Enabling Read Committed Snapshot Isolation (RCSI)

By

This past week I had a great Client ask an even greater question, and...

Query Compile Time

By

A question that came up recently was how to track the query compile time....

Read the latest Blogs

Forums

Cannot attach database after new additional instance installation on sql server

By Fifi

Locate database files did not get out any .mdf file, even though there is...

SELECT column based on parameter

By tshad

Is there a way in the same SELECT statement to show different columns without...

Restore WITH RECOVERY freezing on source DB after tail of log backup

By J-M.L

Hello everyone, I've encountered this scenario twice so far and I still don't understand...

Visit the forum

Ask SSC

SQL Server Q&A from the SQLServerCentral community

Get answers