I was trying an experiment with a query today where instead of creating a temp table in SQL, I used the T-SQL table variable. For a simple example:
DECLARE @ProductTotals TABLE
( ProductID int, Revenue money)
INSERT INTO @ProductTotals (ProductID, Revenue)
SELECT ProductID, SUM(UnitPrice * Quantity)
FROM [Order Details]
GROUP BY ProductID
SELECT *
FROM @ProductTotals
Well, this works fine in SQL Query Analyzer , but not in xMII. I get a message that says "no results returned from this query" So you ask, "why not just use a temp table" Well on the real application, the query can take up to 30 seconds to run, and I have the chance of having multiple users execute the same query in that time, in which my temp table will get stomped on creating an error. So I thought of using table variables as a possible alternative to avoid this.
I have already figured a work around, I put this code into a stored procedure and call that. I could also do a similar workaround using separate queries / BLS. However, I'm curious why xMII wouldn't execute this in the first place, being that it worked fine in Query Analyzer against the exact same database.