@Frank2323 I have created a general example. If the example by @JanDuo specific to the MS SQL sever is good you are set up
If your data is very large you could also writ it out in chunks and append it to an existing CSV file (the example below). Or you could use Parquet file format.