-1

I need to create a txt file from a SQL SERVER DataBase composed as follows:

Products
OutputQuery1

Racks
OutputQuery2

Products per Rack
OutputQuery3

...

OutputQuery1 is only a value returned from Query1

OutputQuery2 is only a value returned from Query2

OutputQuery3:

each row is composed by the following columns: Id_Prod, Id_Rack, NumProd in the txt file I have to show only the number of product.

This is an example:

Products
3
Racks
2

Products per Rack
5 5 5
4 4 4

Have you some suggestion??

Thnaks!

fancyPants
  • 50,732
  • 33
  • 89
  • 96
Baiso
  • 79
  • 8
  • See [SQL Server : export query as a .txt file](http://stackoverflow.com/questions/20620198/sql-server-export-query-as-a-txt-file) – huMpty duMpty Dec 15 '14 at 15:25

1 Answers1

0

You can do this multiple ways:

If you need to export a query to txt.

You can go to the ribbon on the top of SQL server and select Results to text

another way

Right click the top-right corner of the result set while it's in grid view. If formatting is not an issue, you can just directly copy and paste entire contents from here.

Right-Click top-right corner SELECT ALL Copy with Headers/Without Paste to blank txt document.

You could also write an SSIS package.

Hituptony
  • 2,740
  • 3
  • 22
  • 44