SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Query that needs to be used in Cascading parameters report


Query that needs to be used in Cascading parameters report

Author
Message
Mac1986
Mac1986
Mr or Mrs. 500
Mr or Mrs. 500 (561 reputation)Mr or Mrs. 500 (561 reputation)Mr or Mrs. 500 (561 reputation)Mr or Mrs. 500 (561 reputation)Mr or Mrs. 500 (561 reputation)Mr or Mrs. 500 (561 reputation)Mr or Mrs. 500 (561 reputation)Mr or Mrs. 500 (561 reputation)

Group: General Forum Members
Points: 561 Visits: 791
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


Mac1986
Mac1986
Mr or Mrs. 500
Mr or Mrs. 500 (561 reputation)Mr or Mrs. 500 (561 reputation)Mr or Mrs. 500 (561 reputation)Mr or Mrs. 500 (561 reputation)Mr or Mrs. 500 (561 reputation)Mr or Mrs. 500 (561 reputation)Mr or Mrs. 500 (561 reputation)Mr or Mrs. 500 (561 reputation)

Group: General Forum Members
Points: 561 Visits: 791
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


Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search