Answer the question
In order to leave comments, you need to log in
How to start a query execution from the result of another query?
Given:
There is a large select that was previously executed by hand, as a result it produces a set of lines that were enough to insert into the console and start execution (lines like exec xp_cmdshell 'BCP "..."')
Needed:
Actually, as the resulting canvas from exec 'ov run for execution immediately after the select, without copying it to the studio console?
I can write the results of the select to a live\tempo table.
Tried to do through the cursor, but unsuccessfully.
The entire result of the select can be run line by line or all at once, it does not matter
Answer the question
In order to leave comments, you need to log in
Suddenly, someone needs to
declare commands cursor for
SELECT * from table_name
declare cmd varchar(max)
open commands
fetch next from commands into @cmd
while @@FETCH_STATUS=0
begin
exec (@cmd)
fetch next from commands into @cmd
end
close
deallocate commands
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question