I want to run sql in azure studio with output in text format

Madsen, Ken 1 Reputation point
2022-01-11T17:50:47.863+00:00

I want to run multiple statements and get the results in text format, but I can't figure out how to save the results in a text file

SQL Server Other
{count} votes

4 answers

Sort by: Most helpful
  1. Yitzhak Khabinsky 26,586 Reputation points
    2022-01-11T21:04:21.81+00:00

    Hi @Madsen, Ken ,

    Just look at the right side of the Results pane. You will find there options to save as follows:

    • .csv (supposedly what you need)
    • .xslx
    • .json
    • .xml

    Please see below.

    163978-azure-data-studio.jpg

    0 comments No comments

  2. AmeliaGu-MSFT 14,006 Reputation points Microsoft External Staff
    2022-01-12T02:17:56.95+00:00

    Hi MadsenKen-8691,
    Welcome to Microsoft Q&A.
    Unfortunately, Azure Data studio does not currently support saving results as text.

    164065-image.png

    You can save result to CSV as YitzhakKhabinsky mentioned, or as an alternative, you can use SSMS to save result to text.

    164085-image.png

    164163-image.png

    Please refer to this doc and this article which might be help.

    In addition, you can submit it to the Microsoft feedback at this link https://feedback.azure.com/d365community/forum/04fe6ee0-3b25-ec11-b6e6-000d3a4f0da0
    Your feedback is valuable for Microsoft to improve the level of products and service. Appreciate for your understanding.

    Best Regards,
    Amelia


    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


  3. AmeliaGu-MSFT 14,006 Reputation points Microsoft External Staff
    2022-01-13T01:40:11.437+00:00

    Hi MadsenKen-8691,

    Thanks for your reply.
    You can download SSMS from here, and use SSMS to save result to text file.
    Or we can use command-line Bcp utility to export data to text file.
    For example:

    bcp "SELECT * FROM dbo.table" queryout C:\temp\test.txt -S servername-d dbname -c -t, -T  
    

    Please also check Import and export bulk data using bcp and 8 Ways to Export SQL Results To a Text File which might be help.

    Best Regards,
    Amelia


    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    0 comments No comments

  4. Tyler Bushnell 0 Reputation points
    2024-04-04T19:00:22.5733333+00:00

    I was looking at how to do the same thing since my class requires us to put the answers with our queries by copying and pasting the text output. (I'm on a Mac using Microsoft SQL Server, with Azure Data Studio) The best solution I have found that doesn't require many steps is to save the results as Markdown, and it's essentially the same as copying text results.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.