Experts - I have a table called "RunQuery" which has ReportID nvarchar(max) and Formula nvarchar(Max)
The data for this table gets generated from another stored procedure which provides an output like this;
123 Select Name as Customer, sum(val) as Sum_Val from Table1
123 Select Org as Customer, Sum(Val) as Sum_Val from Table1
123 Select Prod as Customer, Sum(met) as Sum_Val from Table1
& so on.
Here, ReportID will be same for all rows however the content in formula will vary. it will have same headers if run seperately.
I need to run these individual queries & store the data in a output table.
Insert into Table_Output (Customer, Sum_Val)
I need this like a loop. can you help please?