For Each Database (EXEC sp_msForEachDB)

Here are some useful examples of the use of the undocumented sp_msForEachDB command:

Basic:

Quotes are complicated :

Note the number of single quotes needed to print is 4 (normally 2).

Leave a Reply

Your email address will not be published.

HTML tags are not allowed.