SMS SQL for Joining Status Message and Attribute Views
Simple query joining status message and attribute views.
----Begin SQL----
SELECT SM.MachineName, SM.Component, SM.MessageID,
COUNT(*) AS 'Count', SMA.AttributeValue
FROM v_StatusMessage SM LEFT OUTER JOIN v_StatMsgAttributes SMA
ON SM.RecordID = SMA.RecordID
GROUP BY SM.Component, SM.MessageID, SM.MachineName, SMA.AttributeValue
ORDER BY SM.Component, SM.MessageID
----End SQL----
----Begin SQL----
SELECT SM.MachineName, SM.Component, SM.MessageID,
COUNT(*) AS 'Count', SMA.AttributeValue
FROM v_StatusMessage SM LEFT OUTER JOIN v_StatMsgAttributes SMA
ON SM.RecordID = SMA.RecordID
GROUP BY SM.Component, SM.MessageID, SM.MachineName, SMA.AttributeValue
ORDER BY SM.Component, SM.MessageID
----End SQL----
About the Author
Emmanuel Tsouris is a Systems Management veteran and Developer Advocate specializing in PowerShell and Cloud Automation. He maintains DotVBS to preserve legacy knowledge for the "archaeologist admin."
Ready to move from VBScript to the Cloud? Check out his book, Pro PowerShell for Amazon Web Services.
Visit EmmanuelTsouris.com for his latest projects.
As an Amazon Associate, I earn from qualifying purchases at no cost to you.
Comments