How to export a SQL table to a .txt file?

0

Good morning!

I need to insert the return data of a Select into a .txt file containing the column names and separating the data with ";"

How can I do this?

Thank you in advance

    
asked by anonymous 06.02.2018 / 13:46

2 answers

1

You can make your query normally, then right-click where it is marked red in the image below and save as CSV, later open the file with notepad, it will be with headers and separated by ";" as below.

IDT_CLIENTE;COD_COMERC;COD_FILIAL;IND_WHITE_LABEL_ATIVO
1;4236304;5556251;NULL
2;4464027;5556452;NULL
20;4261114;5556255;1
22;4236304;5556252;0
24;4503199;5556553;0

    
06.02.2018 / 14:05
0

Or you can go through the wizard: - right button on bank tasks - export data ... - in the source, select SQL Server Native Client (last option) - in destination, flat file destination, places the desired path, ticks if Unicode or not, it is optional to put a qualifier (for example, all fields start and end with quotation marks) - copy data ... - select the table, inform the line delimiter (usually the CR LF) and finally the column delimiter (in this case, semicolon)  - finish

    
07.02.2018 / 14:20