How to Export query result to csv or Tab Delimited File from SSMS - SQL Server/TSQL Tutorial Part 23

preview_player
Показать описание
How to Export query result to csv or Tab Delimited File from SSMS - SQL Server / T-SQL Tutorial

Scenario:

I can view query results in SQL Server Management Studio(SSMS), Is there a way to save the query results to csv file or tab delimited file from SSMS?

Solution:

We often need to save the query results to csv or tab delimited format. SQL Server Management does let us save the results to csv and tab delimited format.

Step 1:
Run your query and go to Grid and right click any where in the grid and then choose Save Results As..

Step 2:
Provide the file name as you like and type csv or tab.

The results will be exports to file. You can open the file with excel or you can open with notepad. Here I opened with notepad.

Check out our website for Different SQL Server, MSBI tutorials and interview questions
such as SQL Server Reporting Services(SSRS) Tutorial
SQL Server Integration Services(SSIS) Tutorial
SQL Server DBA Tutorial
SQL Server / TSQL Tutorial ( Beginner to Advance)
Рекомендации по теме
Комментарии
Автор

This a manual way of doing it. How would you do it automated with a scheduled job?

BravoJ
Автор

but sir I am not getting header in csv or tab delimited file

pradeepab.j
Автор

Sir Please Reply: Is it possible to print these multiple select statements results:
select * from T1
select * from T2
select * from T3
I need to print these type query result in txt/excel... or want to get

shubhamverma-sxre
Автор

Please reply how to in automated way using stored procedure

kokila