Software Metering Query Check please..
Hi, Can someone tell me what is the main difference between these two queries is? I'm asking because there are a few different posts on here about using the below queries, but they both return different results. And when i run Software 09B - Computers with infrequently used software installed the numbers are also different than both these queries. The difference below is: DateDiff(day, SMS_G_System_SoftwareFile.ModifiedDate, GetDate()) > 120 AND DateDiff(day,SMS_MeteredProductRule.LastUpdateTime, GetDate()) > 120 But i'm not sure what they mean. I would like to be able to list the systems that have not used the software in 120 days, in this example. Any help is greatly appreciated. select SMS_R_SYSTEM.ResourceID,SMS_R_SYSTEM.ResourceType,SMS_R_SYSTEM.Name,SMS_R_SYSTEM.SMSUniqueIdentifier,SMS_R_SYSTEM.ResourceDomainORWorkgroup,SMS_R_SYSTEM.Client from SMS_G_System_SoftwareFile INNER JOIN SMS_R_System ON SMS_G_System_SoftwareFile.ResourceID = SMS_R_System.ResourceID INNER JOIN SMS_MeteredFiles ON SMS_G_System_SoftwareFile.FileID = SMS_MeteredFiles.MeteredFileID WHERE SMS_MeteredFiles.RuleID = 101 AND SMS_G_System_SoftwareFile.ResourceID NOT IN (SELECT DISTINCT SMS_MonthlyUsageSummary.ResourceID FROM SMS_MonthlyUsageSummary INNER JOIN SMS_MeteredFiles ON SMS_MonthlyUsageSummary.FileID = SMS_MeteredFile.MeteredFileID WHERE DateDiff(day, SMS_MonthlyUsageSummary.LastUsage, GetDate()) < 120 AND SMS_MeteredFiles.RuleID = 101) select SMS_R_SYSTEM.ResourceID,SMS_R_SYSTEM.ResourceType,SMS_R_SYSTEM.Name,SMS_R_SYSTEM.SMSUniqueIdentifier,SMS_R_SYSTEM.ResourceDomainORWorkgroup,SMS_R_SYSTEM.Client from SMS_G_System_SoftwareFile INNER JOIN sms_R_System ON SMS_G_System_SoftwareFile.ResourceID = SMS_R_System.ResourceID INNER JOIN SMS_MeteredFiles ON SMS_G_System_SoftwareFile.FileID = SMS_MeteredFiles.MeteredFileID INNER JOIN SMS_MeteredProductRule ON SMS_MeteredProductRule.RuleID = SMS_MeteredFiles.RuleID WHERE SMS_MeteredFiles.RuleID = 101 AND DateDiff(day, SMS_G_System_SoftwareFile.ModifiedDate, GetDate()) > 120 AND DateDiff(day,SMS_MeteredProductRule.LastUpdateTime, GetDate()) > 120 AND SMS_G_System_SoftwareFile.ResourceID NOT IN (SELECT DISTINCT SMS_MonthlyUsageSummary.ResourceID FROM SMS_MonthlyUsageSummary INNER JOIN SMS_MeteredFiles ON SMS_MonthlyUsageSummary.FileID = SMS_MeteredFiles.MeteredFileID WHERE DateDiff(day, SMS_MonthlyUsageSummary.LastUsage, GetDate()) < 120 AND SMS_MeteredFiles.RuleID =101)
June 22nd, 2011 10:45pm

Thanks for the response, and help. I found these queries on the forum so i am just trying to understand them. Ok, so SMS_MeteredProductRule.LastUpdateTime means Last time the rule definition was changed. Why would one care about when the rule was changed? And SMS_G_System_SoftwareFile.ModifiedDate, would this represent when the product was installed? To me, the first query, with SMS_MonthlyUsageSummary.LastUsage, this is the Date and time when the metered file was last used during the month, seems to be the most accurate. Is this correct in my understanding? Thanks in advance to any who can help me out.
Free Windows Admin Tool Kit Click here and download it now
June 23rd, 2011 8:43am

DateDiff(day, SMS_G_System_SoftwareFile.ModifiedDate, GetDate()) > 120 means the date and time when the product file's last modified in database was older than 120 days to today. DateDiff(day,SMS_MeteredProductRule.LastUpdateTime, GetDate()) > 120 means the software metering product rule definition's last update date is older than 120 days to today. Thanks
June 23rd, 2011 11:18am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics