Hi all!
I'm trying to figure out how to use temporary tables from within SMS 2003 Reporting. I can do it directly in SQL, such as through Query Analyzer, but when I use the same SQL statements in my web report, it doesn't work. Here's the basic structure of my statement:
=================================
SELECT <some fields>
INTO #TEMP1
FROM <table name>
WHERE <criteria>
ORDER BY <fields>
SELECT <some fields>
INTO #TEMP2
FROM <table name>
ORDER BY <fields>
SELECT #TEMP2.Field1,
#TEMP1.[Field1],
#TEMP1.[Field2],
#TEMP1.[Field3]
FROM #TEMP1 INNER JOIN #TEMP2 ON #TEMP1.Field1 = #TEMP2.Field1
WHERE <criteria>
ORDER BY #TEMP2.Field1
=================================
The SMS web report returns 0 records for each of the first two SELECT statements, and doesn't display anything at all for the third, which are the combined results that I'm actually looking for.
Again, my statement works perfectly in QA, so it's something with the way SMS handles temp tables. I know that SMS allows for multiple select statements and displays the results separately on the same page, but I can't figure out how to use the temp tables. Does anyone have any suggestions or thoughts?
Thanks in advance.
I'm trying to figure out how to use temporary tables from within SMS 2003 Reporting. I can do it directly in SQL, such as through Query Analyzer, but when I use the same SQL statements in my web report, it doesn't work. Here's the basic structure of my statement:
=================================
SELECT <some fields>
INTO #TEMP1
FROM <table name>
WHERE <criteria>
ORDER BY <fields>
SELECT <some fields>
INTO #TEMP2
FROM <table name>
ORDER BY <fields>
SELECT #TEMP2.Field1,
#TEMP1.[Field1],
#TEMP1.[Field2],
#TEMP1.[Field3]
FROM #TEMP1 INNER JOIN #TEMP2 ON #TEMP1.Field1 = #TEMP2.Field1
WHERE <criteria>
ORDER BY #TEMP2.Field1
=================================
The SMS web report returns 0 records for each of the first two SELECT statements, and doesn't display anything at all for the third, which are the combined results that I'm actually looking for.
Again, my statement works perfectly in QA, so it's something with the way SMS handles temp tables. I know that SMS allows for multiple select statements and displays the results separately on the same page, but I can't figure out how to use the temp tables. Does anyone have any suggestions or thoughts?
Thanks in advance.