Fix instance name resolution in performance counter query (#7526)

This commit is contained in:
denzilribeiro 2020-05-20 18:55:37 -05:00 committed by GitHub
parent 89f924639c
commit 5280023abe
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 3 deletions

View File

@ -626,10 +626,10 @@ SET @SQL = N'SELECT DISTINCT
OR RTRIM(spi.object_name) LIKE ''%:Advanced Analytics'') OR RTRIM(spi.object_name) LIKE ''%:Advanced Analytics'')
AND TRY_CONVERT(uniqueidentifier, spi.instance_name) AND TRY_CONVERT(uniqueidentifier, spi.instance_name)
IS NOT NULL -- for cloud only IS NOT NULL -- for cloud only
THEN d.name THEN ISNULL(d.name,RTRIM(spi.instance_name)) -- Elastic Pools counters exist for all databases but sys.databases only has current DB value
WHEN RTRIM(object_name) LIKE ''%:Availability Replica'' WHEN RTRIM(object_name) LIKE ''%:Availability Replica''
AND TRY_CONVERT(uniqueidentifier, spi.instance_name) IS NOT NULL -- for cloud only AND TRY_CONVERT(uniqueidentifier, spi.instance_name) IS NOT NULL -- for cloud only
THEN d.name + RTRIM(SUBSTRING(spi.instance_name, 37, LEN(spi.instance_name))) THEN ISNULL(d.name,RTRIM(spi.instance_name)) + RTRIM(SUBSTRING(spi.instance_name, 37, LEN(spi.instance_name)))
ELSE RTRIM(spi.instance_name) ELSE RTRIM(spi.instance_name)
END AS instance_name,' END AS instance_name,'
ELSE 'RTRIM(spi.instance_name) as instance_name, ' ELSE 'RTRIM(spi.instance_name) as instance_name, '