This topic is locked
[SOLVED]

 Asp runner 6.3 Custom query

8/23/2011 3:25:59 PM
ASPRunnerPro General questions
A
andrews author

Hi All,
I have the query below. It displays the correct output in the Results Tab , In query designer I get Asprunner Pro was unable to parse your sql query.
How do I get this to display in a view or report ?
Thank you in advance
Declare @rc1 int

Declare @rc2 int

Declare @rc3 int

Declare @rc4 int

Declare @rc5 int

Declare @rc6 int

Declare @rc7 int

Declare @rc8 int

Declare @rc9 int

Declare @rc10 int

Declare @rc11 int

Declare @rc12 int

Declare @rc13 int

Declare @rc14 int

Declare @rc15 int

Declare @rc16 int

Declare @rc17 int
SELECT @rc1 = COUNT(Logno)

FROM dbo.Repairs

WHERE (DateRepairComplete between '1/1/2011' and '1/30/2011') AND (Chargeable = 'Y')
SELECT @rc2 = COUNT(Logno)

FROM dbo.Repairs

WHERE (DateRepairComplete between '1/1/2011' and '1/30/2011')AND (Warranty = 'Y')
SELECT @rc3 = COUNT(Logno)

FROM dbo.Repairs

WHERE (DateRepairComplete between '1/1/2011' and '1/30/2011')AND (Warranty = 'N') AND (Chargeable = 'N')
SELECT @rc4 = COUNT(Logno)

FROM dbo.Repairs

WHERE (DateRepairComplete between '1/1/2011' and '1/30/2011')
SELECT @rc5 = COUNT(Logno)

FROM dbo.Repairs

WHERE (DateRepairComplete between '1/1/2011' and '1/30/2011') AND (Chargeable = 'Y') And (Branch = 'CTN')

SELECT @rc6 = COUNT(Logno)

FROM dbo.Repairs

WHERE (DateRepairComplete between '1/1/2011' and '1/30/2011') AND (Chargeable = 'Y') And (Branch = 'DBN')

SELECT @rc7 = COUNT(Logno)

FROM dbo.Repairs

WHERE (DateRepairComplete between '1/1/2011' and '1/30/2011') AND (Chargeable = 'Y') And (Branch = 'PTA')

SELECT @rc8 = COUNT(Logno)

FROM dbo.Repairs

WHERE (DateRepairComplete between '1/1/2011' and '1/30/2011') AND (Chargeable = 'Y') And (Branch = 'JHB')

SELECT @rc9 = COUNT(Logno)

FROM dbo.Repairs

WHERE (DateRepairComplete between '1/1/2011' and '1/30/2011') AND (Warranty = 'Y') And (Branch = 'CTN')

SELECT @rc10 = COUNT(Logno)

FROM dbo.Repairs

WHERE (DateRepairComplete between '1/1/2011' and '1/30/2011') AND (Warranty = 'Y') And (Branch = 'DBN')

SELECT @rc11 = COUNT(Logno)

FROM dbo.Repairs

WHERE (DateRepairComplete between '1/1/2011' and '1/30/2011') AND (Warranty = 'Y') And (Branch = 'PTA')

SELECT @rc12 = COUNT(Logno)

FROM dbo.Repairs

WHERE (DateRepairComplete between '1/1/2011' and '1/30/2011') AND (Warranty = 'Y') And (Branch = 'JHB')
SELECT @rc13 = COUNT(Logno)

FROM dbo.Repairs

WHERE (DateRepairComplete between '1/1/2011' and '1/30/2011') And (Branch = 'CTN')

SELECT @rc14 = COUNT(Logno)

FROM dbo.Repairs

WHERE (DateRepairComplete between '1/1/2011' and '1/30/2011') And (Branch = 'DBN')

SELECT @rc15 = COUNT(Logno)

FROM dbo.Repairs

WHERE (DateRepairComplete between '1/1/2011' and '1/30/2011') And (Branch = 'PTA')

SELECT @rc16 = COUNT(Logno)

FROM dbo.Repairs

WHERE (DateRepairComplete between '1/1/2011' and '1/30/2011') And (Branch = 'JHB')

SELECT @rc17 = COUNT(Logno)

FROM dbo.Repairs

WHERE (DateRepairComplete between '1/1/2011' and '1/30/2011')
select @rc1 as ChRep,@rc2 as WRep , @rc3 as NonRep,@rc4 as AllRep , @rc5 as CRepCTN,@rc6 as CRepDBN , @rc7 as CRepPTA,@rc8 as CRepJHB , @rc9 as WRepCTN , @rc10 as WRepDBN,@rc11 as WRepPTA , @rc12 as WRepJHB

Sergey Kornilov admin 8/23/2011

I would suggest to create a view in SQL Server on the top of this query and use this view as a datasource in ASPRunnerPro.