Quantcast
Channel: THWACK: All Content - Network Performance Monitor
Viewing all articles
Browse latest Browse all 21870

Report Writer advanced SQL help

$
0
0

Our DBA was able to create a temp table and get values that I need for a fiscal year to SUM the values for the whole year period into one value (I.E July1-July1 with a value of uptime %99.98766555 etc..)

This code works fine in MS SQL Studio version 2008 I believe. However, when I try and drop this same code into the report designer in solarwinds it bombs and doesn't work. Unfortunately my DBA is busy on other projects and his response is that it's basic SQL so it should work or at least it does in MS Studio but not in Solarwinds so if one of you SQL solarwinds Guru's can look at the code and tell me what's wrong.

 

Thanks!

 

 

SELECT  TOP 10000 CONVERT(DateTime,
LTRIM(MONTH(DateTime)) + '/01/' + LTRIM(YEAR(DateTime)),
101) AS SummaryMonth,
Nodes.NodeID AS NodeID,
Nodes.VendorIcon AS Vendor_Icon,
Nodes.Caption AS NodeName,
Nodes.IP_Address AS IP_Address,
AVG(ResponseTime.Availability) AS AVERAGE_of_Availability
INTO #yearly_avg_temp
FROM Nodes INNER JOIN ResponseTime ON (Nodes.NodeID = ResponseTime.NodeID)

WHERE
( DateTime BETWEEN 41454 AND 41818 )
AND  
(
  (Nodes.IP_Address = '<SERVER IP>')
)
GROUP BY CONVERT(DateTime, LTRIM(MONTH(DateTime)) + '/01/' + LTRIM(YEAR(DateTime)), 101), 
Nodes.NodeID, Nodes.VendorIcon, Nodes.Caption, Nodes.IP_Address
ORDER BY SummaryMonth ASC, 5 ASC;

SELECT avg(average_of_availability) as [Yearly Average Uptime]

FROM #yearly_avg_temp;

if object_id('tempdb..#yearly_avg_temp') is not null
drop table #yearly_avg_temp;


Viewing all articles
Browse latest Browse all 21870

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>