Is there anything like table variables in T-SQL?
In Sql Server it looks like this:
DECLARE @ProductTotals TABLE
(
ProductID int,
Revenue money
)
Then in procedure I can:
INSERT INTO @ProductTotals (ProductID, Revenue)
SELECT ProductID, SUM(UnitPrice * Quantity)
FROM [Order Details]
GROUP BY ProductID
And manipulate with this variable like an ordinary table.
Here is description: http://odetocode.com/Articles/365.aspx