I have to export some data from SQL Server 2012. I'm interested in flat file export (i.e.: .csv
) but my database has about 500 tables.
Here is an example for you to better understand the situation:
-
Database: ETTEDB_list
-
Table1: list_20140101
- Table2: list_20140102
- .
- ..
- …
- TableN: list_20151706
All these tables have the same structure (number of columns, column names, data types).
Is there any way to automatically export all these tables into .csv
files for later joining into one ore more BIG .csv
files?
Best Answer
You have three options.
Here an example in PowerShell:
You'll need to adjust "YOURSERVER" to the right value and maybe change the path property to the correct folder. Hopefully this will help.