Thursday, June 7, 2007

SMO - Database Status Property

Have a very strange error - or what seems to be an error when running some SMO code...

When doing a simple loop though all of the databases on a server I noticed something strange with one of the properties; the database.status property. I was originally running my code against a 2000 server and there is one db on that server that is set to Offiline. When looping though the dbs on that server and looking at the status property the offline db reported just like the rest - online. When I switched to a 2005 server and set a db to offline I ran my bit of code and noticed that the status now reported 544 as a code for the offline db, this in turn reports to NOTHING as a code from the enum
Debug.WriteLine([Enum].GetName(GetType(DatabaseStatus), db.Status)) again this return an empty value.
Any ideas on this one?