Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

Query that needs to be used in Cascading parameters report Expand / Collapse
Author
Message
Posted Tuesday, April 2, 2013 11:37 PM
SSC Veteran

SSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC Veteran

Group: General Forum Members
Last Login: Sunday, September 14, 2014 1:28 AM
Points: 219, Visits: 693
Hi All,
I need a small help in SSRS report.
My report has 5 parameters.
@ApplicationName - 4 Names comes in the dropdown menu
@EnvironmentName
@ServerName
@StartDateTime
@EndDateTime

Everything works fine. Only help needed here is. Out of 4 names that pop up in the drop down menu, Only the @AppicationName 'Informatica' needs to be used with Query1. Rest all 3 @ApplicationName need to use Query2
Help help me how to build the query in this condition. I tried IF Condition which is not working.
Query1:
SELECT NetworkName,SampleTime, [Max] FROM vinny..PerfData_CPUServerView (nolock) 
Where NetworkName in (@ServerName) And SampleTime >= @StartDateTime and SampleTime <= CONVERT(date, DATEADD(dd, 1, @EndDateTime), 101)
Order by SampleTime asc

Query2:
select NetworkName,SnapshotTime, ProcessUsePct from vinny..SqlResourceUseHistoricView (NOLOCK) 
Where NetworkName in (@ServerName) And Snapshottime >= @StartDateTime and SnapshotTime <= CONVERT(date, DATEADD(dd, 1, @EndDateTime), 101)
Order by SnapshotTime asc

Post #1438173
Posted Wednesday, April 3, 2013 2:49 AM
SSC Veteran

SSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC Veteran

Group: General Forum Members
Last Login: Sunday, September 14, 2014 1:28 AM
Points: 219, Visits: 693
I figured it out. Thanks a ton.
IF OBJECT_ID('TEMPDB..#CPUUsage')IS NOT NULL
DROP TABLE #CPUUsage
CREATE TABLE #CPUUsage(NetworkName varchar(20),startTime Datetime,Value int)
Insert INTO #CPUUsage
SELECT NetworkName,SampleTime, [Max] FROM Singularity.dbo.PerfData_CPUServerView (nolock)
Where NetworkName in (@ServerName) And SampleTime >= @StartDateTime and SampleTime <= CONVERT(date, DATEADD(dd, 1, @EndDateTime), 101)
UNION
Select NetworkName,SnapshotTime, ProcessUsePct from Singularity.dbo.SqlResourceUseHistoricView (NOLOCK)
Where NetworkName in (@ServerName) And Snapshottime >= @StartDateTime and SnapshotTime <= CONVERT(date, DATEADD(dd, 1, @EndDateTime), 101)
order by 2 asc

Select * from #CPUUsage where Networkname = @ServerName

Post #1438212
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse