I have to include one report in my application showing offline/online activity of few databases on SQL Server 2008. Could you please suggest how can I collect the same information from sql server?
You can also use below query to check database status.
SELECT Name, state_desc FROM sys.databases
SELECT DATABASEPROPERTYEX('YOURDATABASE', 'Status')
DatabaseStatus_DATABASEPROPERTYEX
GO
SELECT state_desc DatabaseStatus_sysDatabase
FROM sys.databases
WHERE name = 'YOURDATABASE'
GO
This will tell you the status of the database.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With