Quantcast
Channel: Excel IT Pro Discussions forum
Viewing all articles
Browse latest Browse all 11829

CTE in MS Query Excel 2007

$
0
0

I am trying to display all the daily rates given between two dates with dates that don't have rates too with the help of CTE through MS Query in Excel 2007. I get the follwing errors

[Microsoft][ODBC SQL Server Driver] Invalid Parameter Number 

[Microsoft][ODBC SQL Server Driver] Invalid Descriptor Index

Does MS Query in Excel 2007 support CTE? What is an alternative to this? My code is as follows. It work fine in SQL Server 2008 R2.

;WITH Daily(Flowdate) AS
(
    SELECT ? AS Flowdate --startdate
        UNION ALL
    SELECT Flowdate + 1
        FROM Daily
        WHERE Flowdate +1 < ? --enddate
)
SELECT D.[Flowdate], II.[Name],IH.[Midpoint] AS Rate  
FROM [GAS].[dbo].[IIndex] as II
CROSS JOIN Daily as D
LEFT JOIN [GAS].[dbo].[IndexHistory] IH ON IH.Flowdate = D.[Flowdate] AND IH.IndexId = II.[Id]
WHERE II.[Id] IN (476,437,414,479,419,470,412,463,420,500,439,418)  --Change Indexids here
ORDER BY II.[Name],D.[Flowdate]



Viewing all articles
Browse latest Browse all 11829

Trending Articles



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