'Azure Synapse insert result of exec into a table
Is there a way to insert into temp table result dataset from exec (no matter call of the procedure or execute dynamic SQL) in Azure Synapse Analytics? I didn't find valid examples in the documentation.
E.g.:
create procedure dbo.test
as select 1
create table #t1 (id int)
insert into #t1
exec test
Msg 103010, Level 16, State 1, Line 1 Parse error at line: 2, column: 1: Incorrect syntax near 'exec'.
Solution 1:[1]
Eventually found the workaround like below:
exec ('select ' + @myDynamicCode + ' into #t1')
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Alex |