select * from @variable? - select a variable

1

I made a pivot (dynamic) and the result I store it in a variable, to show the result I made the following instruction:

exec (@queryimiu)

The result of the pivot I want to store it in a table called NewTable:

SELECT * INTO NuevaTabla FROM ( 
SELECT * FROM "pivote"
) AS tablefinal

I just do not know how to print the pivot (which is stored in the variable @queryimiu ) in the table in " pivote "

    
asked by Luigi 14.07.2017 в 19:20
source

1 answer

1

You can do it in the following way:

INSERT INTO testTable (Id, Id2)
SELECT ID, ID2 
from @t

In this very general example it can be seen that the values obtained from the variables @t

are inserted into the table     
answered by 14.07.2017 в 19:31