From 10cb78b712123799f28c17d3ea3c28ad385e0bde Mon Sep 17 00:00:00 2001 From: Aditya Bist Date: Fri, 27 Oct 2017 16:10:38 -0700 Subject: [PATCH] listDatabases now shows online databases only (#534) --- .../Connection/ConnectionService.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Microsoft.SqlTools.ServiceLayer/Connection/ConnectionService.cs b/src/Microsoft.SqlTools.ServiceLayer/Connection/ConnectionService.cs index 8d26f9a4..7ae92a63 100644 --- a/src/Microsoft.SqlTools.ServiceLayer/Connection/ConnectionService.cs +++ b/src/Microsoft.SqlTools.ServiceLayer/Connection/ConnectionService.cs @@ -856,7 +856,7 @@ namespace Microsoft.SqlTools.ServiceLayer.Connection var systemDatabases = new[] {"master", "model", "msdb", "tempdb"}; using (DbCommand command = connection.CreateCommand()) { - command.CommandText = "SELECT name FROM sys.databases ORDER BY name ASC"; + command.CommandText = @"SELECT name FROM sys.databases WHERE state_desc='ONLINE' ORDER BY name ASC"; command.CommandTimeout = 15; command.CommandType = CommandType.Text;