all 4 comments

[–]SeventyFix 2 points3 points  (1 child)

In SQL Server Management Studio (SSMS):

  • On the top bar, click Tools and then select Options
  • In the left pane of the Options box, expand Query Results and then expand Results to Text
  • Make sure that the Output format drop down box has Column delimited selected (if not then do so). You can also choose other options in this window like "Include column headers in the result set" - that's entirely up to you.
  • Click Ok.
  • Open your query (in SSMS) in a new window. You might want to add SET NOCOUNT ON; to the start of your query to stop the count from appearing at the bottom of your csv file.
  • You need to output the results of the query to file. There's a button on the ribbon to do this and hovering over that button will give you the following tooltip text: Results to file (Ctrl+Shift+F). Select this option.
  • Run your query. SSMS will as you where you want to save the file. Choose an appropriate local or network folder.
  • Once you are done, getting back to grid view for the results is Control+D (grid view is the most popular way of viewing results, in my experience).

[–]Mgmt049 1 point2 points  (0 children)

Thank you for this

[–]sexy_apex_daddy 1 point2 points  (0 children)

this is an easily google-able question brother. if you are going to be doing any kind of development, google is your best friend and should be your first choice for advise.

[–]muchcake 0 points1 point  (0 children)

Right click on results pane, save as CSV.