We all have been using the sp_msforeachdb sp without giving it a though or going through the code.. because it is such fun running these sp’s that we kind of ignore the background process and relative performance issues that go along with these, and overall we are happy that we have something that gives us the power to run a query against all instead of running the query one db at a time.
Thanks to out SQL experts like Aaron / Kimberly / Paul and team and tons of other experts who provide such wonderful advice and help us rethink our strategies when it comes to databases.
ok, so I was talking about a good article by Aaron where he rightly points out the older version of sp_msforeachdb sp and he has a reworked version.
http://www.mssqltips.com/sqlservertip/2201/making-a-more-reliable-and-flexible-spmsforeachdb/