I (Actually, someone I work with showed me) found a solution to this. If you are seeing this error when first creating the report definition, the trick is to create a "fake" simple query that works to generate your parameters and fields. Then Save the definition. Then go back in and paste in your original query. This worked for me using a linked server that did NOT have ANSI_WARNINGS or ANSI_NULLS defined at the server level.
Example: FAKE QUERY
Query Type: Anonymous block
Database: UCCE_Historical
Query:
SET ANSI_WARNINGS ON;
SET ANSI_NULLS ON;
SELECT 2019 AS Year, 2 AS Month, 8 AS Week, 49 AS DOY, 2 AS DOW, '02/18/2019' AS DATE, 7140 AS IVRCalls, 10 AS SCRCalls, 10 AS SCRRecordings, 0.12345 AS PerRecorded;
Then Create Parameters (should be none)
Then Create Fields (should succeed at creating the parameters for the fields above. Note: you should generate a fake query that creates the field types you want, for example, for DECIMAL 10 AS Calls, for a TEXT '10' AS Calls, for a DATETIME getdate() AS EndDate, etc)
Save Report Definition
Then go back in and paste the original query you were trying to create.. my example is below
SET ANSI_WARNINGS ON;
SET ANSI_NULLS ON;
-- ORIGINAL FAKE QUERY COMMENTED OUT SELECT 2019 AS Year, 2 AS Month, 8 AS Week, 49 AS DOY, 2 AS DOW, '02/18/2019' AS DATE, 7140 AS IVRCalls, 10 AS SCRCalls, 10 AS SCRRecordings, 0.12345 AS PerRecorded;
-- BEGIN ACTUAL QUERY
declare @StartDate DateTime, @EndDate DateTime
set @StartDate=:start_date
set @EndDate=:end_date
;WITH CCA_IVRDATA(Year, Month, Week, DOY, DOW, DATE, IVRCalls) AS
(SELECT Year= Datepart(yy, DateTime),
Month= Datepart(mm, DateTime),
Week=Datepart(ww, DateTime),
DOY=Datepart(dy, DateTime),
DOW=Datepart(dw, DateTime),
DATE = CONVERT(char(10),DateTime, 101),
IVRCalls=COUNT(*)
FROM Route_Call_Detail
WHERE DateTime BETWEEN @StartDate AND @EndDate
GROUP BY Datepart(yy, DateTime),
Datepart(mm, DateTime),
Datepart(ww, DateTime),
Datepart(dy, DateTime),
Datepart(dw, DateTime),
CONVERT(char(10),DateTime, 101)),
etc... the rest of your query...
... View more