We recently built a custom SQL report and displayed the results using the web-based reporter in Orion 2014.2 (NPM 11.0.1). The report was intended to find possible duplicate nodes by isolating the node name where the nodes could be just the node name or FQDN. We started off with this SQL logic.
ANd
SELECTSUBSTRING(caption, 1,CASECHARINDEX('.',caption)WHEN 0 THENLEN(caption)ELSECHARINDEX('.',caption)-1 END)ASNodeName,
SUBSTRING(caption,CASECHARINDEX('.',caption)WHEN 0 THENLEN(caption)+1 ELSECHARINDEX('.',caption)+1 END, 1000)ASDomainName,
Caption,
IP_Address,
OwnerGroup,
Comments
FROMNodesWITH (NOLOCK)
WHERESUBSTRING(caption, 1,CASECHARINDEX('.',caption)WHEN 0 THENLEN(caption)ELSECHARINDEX('.',caption)-1 END)IN(
SELECTSUBSTRING(caption, 1,CASECHARINDEX('.',caption)WHEN 0 THENLEN(caption)ELSECHARINDEX('.',caption)-1 END)
FROMNodesWITH (NOLOCK)GROUPBYSUBSTRING(caption, 1,CASECHARINDEX('.',caption)WHEN 0 THENLEN(caption)ELSECHARINDEX('.',caption)-1 END)
HAVINGCOUNT(*)> 1)
ANDSUBSTRING(caption, 1,CASECHARINDEX('.',caption)WHEN 0 THENLEN(caption)ELSECHARINDEX('.',caption)-1 END)NOTBETWEEN'1'AND'255'
ORDERBYCaption
And we configured the table to Group results by NodeName from the query above. The resulting data looked like the following (minus the redacted part) -- notice that the nodes are not distinctly grouped.
Puzzled, I decided to force the capitalization on the NodeName to allow lowercase. SQL isn't case dependent but maybe the grouping on the web-based reports was!
SELECTLOWER(SUBSTRING(caption, 1,CASECHARINDEX('.',caption)WHEN 0 THENLEN(caption)ELSECHARINDEX('.',caption)-1 END))ASNodeName,
SUBSTRING(caption,CASECHARINDEX('.',caption)WHEN 0 THENLEN(caption)+1 ELSECHARINDEX('.',caption)+1 END, 1000)ASDomainName,
Caption,
IP_Address,
OwnerGroup,
Comments
FROMNodesWITH (NOLOCK)
WHERELOWER(SUBSTRING(caption, 1,CASECHARINDEX('.',caption)WHEN 0 THENLEN(caption)ELSECHARINDEX('.',caption)-1 END))IN(
SELECTLOWER(SUBSTRING(caption, 1,CASECHARINDEX('.',caption)WHEN 0 THENLEN(caption)ELSECHARINDEX('.',caption)-1 END))
FROMNodesWITH (NOLOCK)GROUPBYLOWER(SUBSTRING(caption, 1,CASECHARINDEX('.',caption)WHEN 0 THENLEN(caption)ELSECHARINDEX('.',caption)-1 END))
HAVINGCOUNT(*)> 1)
ANDLOWER(SUBSTRING(caption, 1,CASECHARINDEX('.',caption)WHEN 0 THENLEN(caption)ELSECHARINDEX('.',caption)-1 END))NOTBETWEEN'1'AND'255'
ORDERBYCaption
Notice that the nodes are now grouped together by the common NodeName. The change was the LOWER() function in the query.
Has anyone else run into this before? Does the newer version of Orion and/or NPM resolve this issue?