Mohlerp1942
asked on
Microsoft Reporting Services - SQL Query
I have three datasets two that populate a temporary table called ##GlobalTable1 the first dataset creates the global table and inserts records. Query shown below is Dataset "GlobalLocalTable"
SELECT ASSMNT_TOPIC_1.ASSMNT_TOPI C_NAME AS Column1, COND_TOPIC_1.COND_TOPIC_NA ME AS Column2Name, dbo.COND_TOPIC.COND_TOPIC_ NAME AS Column3,
COUNT(COND_TOPIC_1.COND_TO PIC_NAME) AS Column2Count
INTO [##GlobalTable1]
FROM dbo.COND INNER JOIN
dbo.COND_TOPIC ON dbo.COND.COND_TOPIC_ID = dbo.COND_TOPIC.COND_TOPIC_ ID INNER JOIN
dbo.COND_TOPIC COND_TOPIC_1 ON dbo.COND_TOPIC.PARENT_COND _TOPIC_ID = COND_TOPIC_1.COND_TOPIC_ID INNER JOIN
dbo.ASSMNT_TOPIC ON dbo.COND_TOPIC.PARENT_COND _TOPIC_ID = dbo.ASSMNT_TOPIC.ASSMNT_TO PIC_ID INNER JOIN
dbo.ASSMNT_TOPIC ASSMNT_TOPIC_1 ON dbo.ASSMNT_TOPIC.PARENT_AS SMNT_TOPIC _ID = ASSMNT_TOPIC_1.ASSMNT_TOPI C_ID
WHERE (dbo.COND.INSERT_DATE >= @BeginPeriod) AND (dbo.COND.INSERT_DATE <= @EndPeriod)
GROUP BY ASSMNT_TOPIC_1.ASSMNT_TOPI C_NAME, dbo.COND_TOPIC.COND_TOPIC_ NAME, COND_TOPIC_1.COND_TOPIC_NA ME
ORDER BY ASSMNT_TOPIC_1.ASSMNT_TOPI C_NAME, COND_TOPIC_1.COND_TOPIC_NA ME, dbo.COND_TOPIC.COND_TOPIC_ NAME
The second query appends records to same table. See below! This Dataset is "InsertIntoGlobalTable"
INSERT INTO [##GlobalTable1]
SELECT COND_TOPIC_1.COND_TOPIC_NA ME AS Column1, dbo.COND_TOPIC.COND_TOPIC_ NAME AS Column2Name, 'N/A' AS Column3, COUNT(dbo.COND_TOPIC.COND_ TOPIC_NAME )
AS ColumnCount
FROM dbo.COND INNER JOIN
dbo.COND_TOPIC ON dbo.COND.COND_TOPIC_ID = dbo.COND_TOPIC.COND_TOPIC_ ID INNER JOIN
dbo.COND_TOPIC COND_TOPIC_1 ON dbo.COND_TOPIC.PARENT_COND _TOPIC_ID = COND_TOPIC_1.COND_TOPIC_ID
WHERE (dbo.COND.INSERT_DATE >= @BeginPeriod) AND (dbo.COND.INSERT_DATE <= @EndPeriod)
GROUP BY COND_TOPIC_1.COND_TOPIC_NA ME, dbo.COND_TOPIC.COND_TOPIC_ NAME, COND_TOPIC_1.PARENT_COND_T OPIC_ID
HAVING (COND_TOPIC_1.PARENT_COND_ TOPIC_ID IS NULL)
The third dataset queries the temporary table. See query below! Dataset name is "GetLocalGlobal"
SELECT Column1, Column2Name, Column3, Column2Count
FROM [##GlobalTable1]
I want to use the third Dataset to populate my report.
When I test these queries from the Data tab they work, but when I try to run the report I get the error message
"An error has occurred during processing. Query execution failed for dataset "GetLocalGlobal" invalid object name '##GlobalTable1'
I don't understand the error message.
SELECT ASSMNT_TOPIC_1.ASSMNT_TOPI
COUNT(COND_TOPIC_1.COND_TO
INTO [##GlobalTable1]
FROM dbo.COND INNER JOIN
dbo.COND_TOPIC ON dbo.COND.COND_TOPIC_ID = dbo.COND_TOPIC.COND_TOPIC_
dbo.COND_TOPIC COND_TOPIC_1 ON dbo.COND_TOPIC.PARENT_COND
dbo.ASSMNT_TOPIC ON dbo.COND_TOPIC.PARENT_COND
dbo.ASSMNT_TOPIC ASSMNT_TOPIC_1 ON dbo.ASSMNT_TOPIC.PARENT_AS
WHERE (dbo.COND.INSERT_DATE >= @BeginPeriod) AND (dbo.COND.INSERT_DATE <= @EndPeriod)
GROUP BY ASSMNT_TOPIC_1.ASSMNT_TOPI
ORDER BY ASSMNT_TOPIC_1.ASSMNT_TOPI
The second query appends records to same table. See below! This Dataset is "InsertIntoGlobalTable"
INSERT INTO [##GlobalTable1]
SELECT COND_TOPIC_1.COND_TOPIC_NA
AS ColumnCount
FROM dbo.COND INNER JOIN
dbo.COND_TOPIC ON dbo.COND.COND_TOPIC_ID = dbo.COND_TOPIC.COND_TOPIC_
dbo.COND_TOPIC COND_TOPIC_1 ON dbo.COND_TOPIC.PARENT_COND
WHERE (dbo.COND.INSERT_DATE >= @BeginPeriod) AND (dbo.COND.INSERT_DATE <= @EndPeriod)
GROUP BY COND_TOPIC_1.COND_TOPIC_NA
HAVING (COND_TOPIC_1.PARENT_COND_
The third dataset queries the temporary table. See query below! Dataset name is "GetLocalGlobal"
SELECT Column1, Column2Name, Column3, Column2Count
FROM [##GlobalTable1]
I want to use the third Dataset to populate my report.
When I test these queries from the Data tab they work, but when I try to run the report I get the error message
"An error has occurred during processing. Query execution failed for dataset "GetLocalGlobal" invalid object name '##GlobalTable1'
I don't understand the error message.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.