Home / Programming / Blog article: SQL Server 2008 – Find If A Database Is Offline With T-SQL

| RSS

SQL Server 2008 – Find If A Database Is Offline With T-SQL

March 3rd, 2009 | No Comments | Posted in Programming

In SQL Server 2008 you can find if a database is online of offline by querying databases system view. A simple query such as this one gives me a list of all databases on my server and the second column shows if the database is online or offline.

SELECT Name, state_desc
FROM sys.databases

image

On my server I have a database called LinqToSqlLab which is currently offline.

Leave a Reply 2698 views, 2 so far today |
Tags:

Leave a Reply





Switch to our mobile site