RE: SMS 2003 Query Software Distribution Status

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



I found a solution that sort of works for me, but I need help fine-tuning it.
Basically I've modified the original script down to show me systems that
failed, but I need to hard code the Advertisement ID so it will work in a
collection and not prompt.

The original code is...
select stat.*, ins.*, att1.*, att1.AttributeTime from SMS_StatusMessage as
stat left join SMS_StatMsgInsStrings as ins on stat.RecordID = ins.RecordID
left join SMS_StatMsgAttributes as att1 on stat.RecordID = att1.RecordID
inner join SMS_StatMsgAttributes as att2 on stat.RecordID = att2.RecordID
where stat.ModuleName = "SMS Client" and stat.MessageID >= 10008 and
stat.MessageID <= 10009 and att2.AttributeID = 401 and att2.AttributeValue =
##PRM:SMS_StatMsgAttributes.AttributeValue## and stat.SiteCode =
##PRM:SMS_StatusMessage.SiteCode## and att2.AttributeTime >=
##PRM:SMS_StatMsgAttributes.AttributeTime## order by att1.AttributeTime desc

My modification is...
select stat.*, ins.*, att1.*, att1.AttributeTime from SMS_StatusMessage as
stat left join
SMS_StatMsgInsStrings as ins on stat.RecordID = ins.RecordID left join
SMS_StatMsgAttributes as att1
on stat.RecordID = att1.RecordID inner join SMS_StatMsgAttributes as att2 on
stat.RecordID =
att2.RecordID where stat.ModuleName = "SMS Client" and stat.MessageID =
10070 and att2.AttributeID = 401 and att2.AttributeValue =
##PRM:SMS_StatMsgAttributes.AttributeValue##

When I try and hard code AttributeValue it errors. Any help in getting this
last step working is greatly appreciated!

Original source for this code is
http://myitforum.techtarget.com/articles/1/view.asp?id=843

"Brian C. from Boulder" wrote:

> Hi! I've been trying to create a query that I can then turn into a collection
> based on Advertisement ID and failed status. How is this done?
>
> Thank you!
.