Okay, what I'm trying to do is take the results from a stored procedure and put them into a temp table...
Looks like this:
DECLARE @Table TABLE(
[ID] int,
[CostA] real,
[CostB] real,
[CostC] real
)
INSERT INTO @Table
EXECUTE [dbo].[CostProcedure]
@RootId = 123
@Rate = 20
--THEN:
SELECT * FROM @Table -- Gives Me:
ID CostA CostB CostC
10 0 0 0
-- HOWEVER
EXECUTE [dbo].[CostProcedure]
@RootId = 123
@Rate = 20
--GIVES ME
ID CostA CostB CostC
10 1.0987 0.9837 0.65463
So my question is, since the stored procedure is obviously returning the proper results, why when I insert them into a table variable does it only insert the first column of the results and give all zeros on the subsequent columns? Is there some known issue with this I don't know about??? I even tried:
INSERT INTO @Table([ID],[CostA],[CostB],[CostC])
EXECUTE [dbo].[CostProcedure]
@RootId = 123
@Rate = 20
It yielded the same result...
I even tried a throwback, and tried a temp table (Create table #whatever)... Still the same result... What the heck am I missing?
I'm just wondering... If CostProcedure has a StoredProcedure inside of it that writes a value to a temp table, the same as above, maybe there is some limit on the number of levels you can nest stored procedures writing to temp tables?