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

Asked

Viewed 2,099 times

0

good morning!

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

How can I do this process?

Grateful From Now

  • 3

    I think this post will help you. https://stackoverflow.com/a/17782033/4312593

2 answers

1


You can do 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, 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

inserir a descrição da imagem aqui

0

Or you can go to Wizard: - right click on the seat - tasks - export data... - at source, select SQL Server Native Client (last option) - in destination, flat file Destination, puts the desired path, checks whether Unicode or not, it is optional to put a qualifier (for example, all fields start and end with quotes) - copy data... - select the table, enter the line delimiter (usually CR LF) and finally the column delimiter (in your case semicolon) - Finish

Browser other questions tagged

You are not signed in. Login or sign up in order to post.