need to run several Sql Server 2014 select queries and write the results to excel sheets
select docname from TbDocs where plant = 'Plant1' - Write to Plant1.xlsx
select docname from TbDocs where plant = 'Plant2' - Write to Plant2.xlsx
select docname from TbDocs where plant = 'Plant3' - Write to Plant3.xlsx
.. has 20 plants total
I need this Each plant data going to separate excel files , due to some requiremnt
(NOTE: It can be text files instead of excel files, If I can read it in excel later)
Can I have a batch sql script running and writing it to 20 Plant excel files in one shot?