How to list all columns of a given SQL query

Is there an easy way to get a list of all the columns of a SQL query? They are listed in the title bar of the SSMS results window, but I cannot copy them.

Thanks in advance.

EDIT

Sorry, I found it myself after a short search:

http://vidmar.net/weblog/archive/2008/06/05/save-sql-query-results-with-column-names-in-msssms.aspx

+3
source share
3 answers

Go to the Query -> Query Options section and check the box alt text

+4
source

If you go to Results to Text, you can copy them.

, :

SET FMTONLY ON;
SELECT * FROM SomeTable;

, . , .

+2

Change the results window to Results to Text instead of Results to Grid.

This can be done by clicking the icon icon above the query window. It looks like a notepad icon.

0
source

Source: https://habr.com/ru/post/1766177/


All Articles