Microsoft SQL Server error referencing sys.databases

Practice



Sometimes Microsoft SQL Server throws an error referring to sys.databases, suggesting we check the information in the specified column.

To see what exactly the server doesn't like, open Microsoft SQL Management Studio, click the "Database Engine Query" button and enter the following query:

SELECT * FROM sys.databases;

Then click "Execute".

In the output you'll see columns with the state and rows — one row per attached database. If you need to pull out a specific column from a specific database, you can specify them in the SELECT conditions. For example, let's pull out the "log_reuse_wait_desc" column from the "mybase" database:

SELECT name,log_reuse_wait_desc FROM sys.databases WHERE name='mybase';


Applies to: Microsoft SQL Server 2005, 2008
created: 2017-05-09
updated: 2026-03-09
427



Was this answer useful?
Choose a quick rating so we can improve the next answer for you.
How satisfied are you?


Comments

To leave a comment

If you have any suggestion, idea, thanks or comment, feel free to write. We really value feedback and are glad to hear your opinion.
To reply

Lectures and tutorial on "Databases - MySql (Maria DB)"

Terms: Databases - MySql (Maria DB)