View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Ruz Ruz is offline
external usenet poster
 
Posts: 1
Default parameters not allowed in queries that can't be displayed graphica

Hi,

I'm trying to run a sproc that was created on SQL server and has two date
parameters. I can run the sproc easily enough with fixed values but it
doesn't work with parameters as the sproc can't be displayed graphically?!?!

I have seen that the suggested solution is to create a view but as this
query uses group by, using the where clause in a view to specify the
parameteres will not give the correct result set.

This is part of the SQL from the sproc......

SELECT SG.SchemeName as SchemeName,
'Fail' as Type,
COUNT(CASE WHEN Q.Createdby = 'WEBUSER' THEN 1 END) as Web,
COALESCE(SUM(CASE WHEN Q.Createdby = 'WEBUSER') THEN Q.GrossPremium END),0)
as Value
FROM Quote Q
INNER JOIN SchemeGroup SG
ON Q.SchemeGroupID = SG.ID
INNER JOIN SubScheme SS
ON Q.ID = SS.QuoteID
WHERE lql.dbo.isPolicy(Q.ID) = 0
AND Q.CreatedAt BETWEEN @SDATE AND @FDATE
GROUP BY SG.SchemeName
ORDER BY SG.SchemeName,Type desc

Any help or ideas would be appreciated.

Thanks,

Ruz