SCCM WOL waking PC's hour early.
Well, if your report timestamps are off 5 to 6 hours, you may need to modify your query to adjust to the UTC format that SCCM puts some information in. This KB applies to SMS, but is the same for SCCM: http://support.microsoft.com/kb/830642 It tells you how to write a query that contains data in UTC Format. When you run the queries in SQL, you'll need to declare and set the @__timezoneoffset integer... like so:
When I copy the same code in Reporting Services gui(without declaring the @__timezoneoffset variable), I get an error that the varible has already been defined. Even though I'm not declaring it... just calling it. Can you tell me why I'm getting the "already declared" error message or how to work around it? Thanks in advance.
Here's my query I built and executed in SQL Config mgr just fine.
*** (BEGIN: this portion is omitted within Reporting services reports query) ***
declare @__timezoneoffset int
select @__timezoneoffset = DateDiff(HOUR,getutcdate(),getdate())
*** (END: this portion is omitted within Reporting services reports query) ***
SELECT DISTINCT
dbo.v_AdvertisementInfo.AdvertisementName,
dbo.v_AdvertisementInfo.PackageName,
dbo.v_R_System.Name0,
dbo.v_ClientAdvertisementStatus.LastStatusMessageID,
dbo.v_ClientAdvertisementStatus.LastStatusMessageIDName,
DATEADD(HOUR,@__timezoneoffset,(SELECT dbo.v_ClientAdvertisementStatus.laststatustime)) AS 'Last Status Time'
FROM dbo.v_AdvertisementInfo
LEFT OUTER JOIN dbo.v_ClientAdvertisementStatus
ON dbo.v_AdvertisementInfo.AdvertisementID = dbo.v_ClientAdvertisementStatus.AdvertisementID
LEFT OUTER JOIN dbo.v_R_System
ON dbo.v_ClientAdvertisementStatus.ResourceID = dbo.v_R_System.ResourceID
WHERE (dbo.v_ClientAdvertisementStatus.LastStatusMessageID IN (11171, 10008))
AND (dbo.v_ClientAdvertisementStatus.LastStatusTime
BETWEEN DATEADD(HOUR,@__timezoneoffset+5,CURRENT_TIMESTAMP) AND DATEADD(HOUR,@__timezoneoffset+6,CURRENT_TIMESTAMP))
ORDER BY dbo.v_AdvertisementInfo.PackageName, Name0
January 23rd, 2010 12:41am