save query result in a file | SQL Server Performance Forums

SQL Server Performance Forum – Threads Archive

save query result in a file

If I want to save the output of
"select * from <table>" in C:/file.txt then what will be the store procedure? Thanks,
Litu
you can use SQLCMD of OSQL with -o switch sqlcmd -q"Your query" -o"your output filename" read more about these command in BOL Madhu
You can use BCP too…
Check BOL for syntax…
MohammedU.
Moderator
SQL-Server-Performance.com All postings are provided “AS IS” with no warranties for accuracy.

]]>