I have an sp which I want to store inside a temporary table, either a table variable or a temporary table, in both cases, this error marks me:
An INSERT EXEC statement can not be nested.
This is my code that I am generating to store the sp, it is worth mentioning that the problem is not with the sp, but in the way of storing it. The sp code is not added because it is very extensive.
I hope and you can help me
declare @tempo table ( CeEmplazamiento varchar(50), TotalGeneral decimal, TotGral decimal ) INSERT into @tempo exec sp_telemetria_safety_mensual 'Diciembre'
The sp, generates me final calculations that throws me at the end.
CeEmplazamiento TotalGeneral TotGral Celaya 76.500000 81.000000 Coecillo 79.000000 81.000000 Irapuato 77.500000 81.000000 León Sur 85.750000 81.000000 Los Reyes 0.000000 81.000000 Oriente León 86.250000 81.000000
There is something that I would also like to add, what I am trying to do is that the result of the sp. is stored 2 TIMES in the same table.
INSERT into @tempo exec sp_telemetria_safety_mensual 'Diciembre' exec sp_telemetria_safety_mensual 'Enero'