Jasinski Technical Wiki

Navigation

Home Page
Index
All Pages

Quick Search
»
Advanced Search »

Contributor Links

Create a new Page
Administration
File Management
Login/Logout
Your Profile

Other Wiki Sections

Software

PoweredBy

List Databases In Use - SQL Server

RSS
Modified on Thu, Apr 28, 2016, 10:40 PM by Administrator Categorized as SQL Server

Overview

The following SQL statement gives a list of all databases that are active (online) for a SQL Server instance.

SQL Statement

select 
    name, state_desc
from 
    sys.databases
where 1=1
    and name not in ('master','msdb','tempdb','model')
    and state_desc not in ('OFFLINE','SUSPECT')
order by 
    name

ScrewTurn Wiki version 3.0.1.400. Some of the icons created by FamFamFam. Except where noted, all contents Copyright © 1999-2018, Patrick Jasinski.