Sql-server – How to create trigger on database that ‘triggers’ when mirroring role changes from mirror to principal

sql server

I want to perform some sql when my database mirroring state changes

Best Answer

Create an event notification for the Database Mirroring State Change. See Implementing Event Notifications for how to design a service that processes the notification and does whatever is appropriate. Keep in mind that event notifications are asynchronous.