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;