Part 1: In a Microsoft SQL Server 2005 failover scenario, how can the databases be queried to determine which server is the master and which server is the slave? I'm looking for something more elegant than attempting to query on the server and see which one throws an exception.
Part 2: Is there a way to monitor and determine when the master SQL Server fails over to the slave?
The end goal of this is to have a script, or another method, that will keep track of the servers and send notifications when a failover occurs.