Sign in with Microsoft
Sign in or create an account.
Hello,
Select a different account.
You have multiple accounts
Choose the account you want to sign in with.

INTRODUCTION

This article describes how to create .rpt or .csv files from an SQL statement in SQL Query Analyzer, in SQL Server Management Studio, and in the Support Administrator Console.

More Information

To create .rpt or .csv files from an SQL statement, use one of the following methods.

Method 1: SQL Query Analyzer

  1. Click Start, point to All Programs, point to Microsoft SQL Server, and then click Query Analyzer.

  2. In the Connect to SQL Server dialog box, enter the sa user name and password, and then click OK.

  3. Click Query, and then click Results to File.

  4. Enter and then execute the SQL statement.

  5. In the Save Results dialog box, specify the following settings:

    • Save In: Select a directory in which to save the file.

    • File Name: Type a name for the file.

    • Save as type: Report Files (*.rpt or *.csv)

  6. Click Save.

  7. To open the report file in SQL Query Analyzer, click Open on the File menu.

  8. In the Files of Type list, click All Files (*.*).

  9. Click the report file, and then click Open.

Method 2: SQL Server Management Studio

  1. Click Start, point to All Programs, point to Microsoft SQL Server 200X, (your version)and then click SQL Server Management Studio.

  2. In the Connect to Server dialog box, specify the following settings:

    • Authentication: SQL Server Authentication

    • Login: sa

    • Password: Type the sa password.

  3. Click Connect.

  4. Click New Query.

  5. On the Query menu, point to Results to, and then click Results to File.

  6. Enter and then execute the SQL statement.

  7. In the Save Results dialog box, specify the following settings:

    • Save In: Select a directory in which to save the file.

    • File Name: Type a name for the file.

    • Save as type: Report Files (*.rpt or *.csv)

  8. Click Save.

  9. To open the report file in SQL Server Management Studio, point to Open on the File menu. Then, click File.

  10. In the Files of Type list, click All Files (*.*).

  11. Click the report file, and then click Open.

Method 3: Support Administrator Console


  1. Click Start, point to Programs, point to Microsoft Support Administrator Console, and then click Support Administrator Console.

  2. In the Connect to SQL Server dialog box, specify the following settings:

    • Login Name: sa

    • Password: Type the sa password.

  3. Click OK.

  4. Enter and then execute the SQL statement.

  5. On the File menu, click Export.

  6. In the Save As dialog box, specify the following settings:

    • File name: Type a name for the file.

    • Save as Type: CSV Files (*.csv)

  7. Click Save.

    Note This .csv file can be opened in Microsoft Excel.

Need more help?

Want more options?

Explore subscription benefits, browse training courses, learn how to secure your device, and more.

Communities help you ask and answer questions, give feedback, and hear from experts with rich knowledge.

Was this information helpful?

What affected your experience?
By pressing submit, your feedback will be used to improve Microsoft products and services. Your IT admin will be able to collect this data. Privacy Statement.

Thank you for your feedback!

×