diff --git a/plugins/dbms/mssqlserver/enumeration.py b/plugins/dbms/mssqlserver/enumeration.py
index 922119d61..650e6baa3 100644
--- a/plugins/dbms/mssqlserver/enumeration.py
+++ b/plugins/dbms/mssqlserver/enumeration.py
@@ -93,8 +93,11 @@ class Enumeration(GenericEnumeration):
continue
- query = rootQuery.inband.query.replace("%s", db)
- value = inject.getValue(query, blind=False)
+ for query in (rootQuery.inband.query, rootQuery.inband.query2):
+ query = query.replace("%s", db)
+ value = inject.getValue(query, blind=False)
+ if not isNoneValue(value):
+ break
if not isNoneValue(value):
kb.data.cachedTables[db] = arrayizeValue(value)
diff --git a/plugins/generic/enumeration.py b/plugins/generic/enumeration.py
index c826bf32a..5ea0d4d31 100644
--- a/plugins/generic/enumeration.py
+++ b/plugins/generic/enumeration.py
@@ -887,9 +887,6 @@ class Enumeration:
if len(dbs) < 2 and ("%s," % condition) in query:
query = query.replace("%s," % condition, "", 1)
- if Backend.isDbms(DBMS.MSSQL):
- query = safeStringFormat(query, conf.db)
-
value = inject.getValue(query, blind=False)
if not isNoneValue(value):
diff --git a/xml/queries.xml b/xml/queries.xml
index 878a984dd..deb84feef 100644
--- a/xml/queries.xml
+++ b/xml/queries.xml
@@ -184,7 +184,7 @@
-
+