From the database: Getting dbinfo for all databases within an instance

By | September 20, 2014

Nothing too clever here. In fact, quite the opposite. I’m posting so I can find this again in the future..!

I recently needed to take some data about a large number of databases on an instance and generate a report for people that probably wouldn’t read said report.

As is becoming a trait recently, dynamic SQL to the rescue.

Iterate all the online databases and run a DBCC dbinfo against them. The ‘WITH tableresults’ forces the output to the console (in my case a file) so it can be used. Simples.

Usual caveats and lack of warranty applies 😉

more to follow…

Leave a Reply

Your email address will not be published. Required fields are marked *