

You can save the results in a file from here. SQLCMD is the SQL Server Command Line utility. We will call the results in a file named Results.rpt: An option to specify the name and path will be displayed. Go to Tools>Options:Ĭreate a query and execute the query.

If you want to save the results in a txt file, you can do this in SSMS. The result displayed in SQL Server Management Studio (SSMS) is the following: We will use the following script, named myscript.sql: In the first option, we will configure SSMS to display the query results to a txt file. Let's look at each of the ways we can export the results of a query. You need a SQL Server Installed with SSIS and SQL Server Data Tools (SSDT).

This article will show eight ways to export rows from a T-SQL query to a txt file. We will show the following options:
