title: Create mulitple csv automatically from different select statements & save in a given path
body: <p>I have a stored procedure to return csv output in a path after the query executes. But it only works for a single csv. </p>
  
  <p>I want a script to generate multiple csv together from multiple SQL statements and store in a path.</p>
  
  <p>My input is <a href="https://i.stack.imgur.com/eA8Ob.jpg" rel="nofollow noreferrer">here</a></p>
  
  <pre><code>---------------------------------------------
  --- Generating output csv by stored procedure
  ---------------------------------------------
  
  DECLARE @sql NVARCHAR(MAX) = 'SELECT * from #TMP_Lazyone_All_Final'
  DECLARE @file_path NVARCHAR(4000) = N'D:\a\Lazyone_ComplexProducts_Final.csv' -- Change filename path
  DECLARE @Status INT = 1
  
  EXECUTE spa_util_GetCsv  @DBFetch = @sql,               
                  @Header = 1,
                  @PCWrite = @file_path,
                  @HeaderQuote = 0,
                  @Status = @Status OUTPUT    
  </code></pre>