Checking Status Of SQL Server 2005/2008 Database: Another Quickie
Here’s another quickie. If you liked my Monitoring SQL Server Performance Quickie, I’m sure you will love this yet another quickie.
Suppose you want to check the status of a particular database (Online, Offline, etc), there’s a quickie for that. Here it is:
SELECT databasepropertyex('TestDB', 'STATUS')
You can find the complete list of the properties that you can use from this link: http://msdn.microsoft.com/en-us/library/ms186823.aspx