Necesita ayuda para imprimir los resultados de la consulta en un archivo/texto

This SSMS newbie is trying to print the results of a query instead of having it directed to the grid I followed the following steps:

Management Studio -->> Tools -->>Options -->>

Query Results -->>General -->> Results to text and c:\works as Default location for saving query

Query Results -->>SQL Server -->> Results to text -->>Include column headers when copying or saving...

yet, when query is executed, I don't see the results at all could someone please shed the light my way as to how can I get the query results saved to a file that I can print later on?

preguntado el 09 de septiembre de 13 a las 21:09

3 Respuestas

If you send the results direct to file, you can't see them in the Results pane in SSMS.

Tienes tres opciones:

  • Results to Text (plain text, in the Results pane)
  • Results to Grid (grid view, with resizeable columns & rows similar to Excel)
  • Results to File (writes direct to file, results not displayed)

You can choose between these options from the Query -> Results menu, buttons on the Standard toolbar, or keyboard shortcuts (CTRL-T,CTRL-D, CTRL-SHIFT-F, in the order above). Select your output "mode", then execute the query.

With the first two options, you can right-click the results and save to a file from there. Or copy/paste elsewhere.

With Results to File, it will output the results in a file in your default location (c:\works\ en tu caso) pero it should prompt you with the standard Windows File Save dialog.

Respondido el 09 de Septiembre de 13 a las 21:09

You need to select "Results to File" not "Results to Text". When you then go back and run your query, you will not see any query results, just a prompt for the file name you want to save the results as.

Respondido el 09 de Septiembre de 13 a las 21:09

You don't want Results to Text. You want Results to File. Then, when you execute the query, you'll be prompted for the file name to save under.

Respondido el 09 de Septiembre de 13 a las 21:09

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.