Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 Transact-SQL (2000)
 how to export the result sql to format txt

Author  Topic 

djokerss
Starting Member

28 Posts

Posted - 2004-07-14 : 01:47:08

how to export the result of query to format txt.
for example i want to export the result to c:\result.txt

timmy
Master Smack Fu Yak Hacker

1242 Posts

Posted - 2004-07-14 : 01:56:47
Check out the BCP command line utility. It will do exactly what you want.
See books online for more details.


Go to Top of Page

Kristen
Test

22859 Posts

Posted - 2004-07-14 : 03:57:45
If you just want to do this as a one-off you can use Query Analyser and do
Tools : Options : [Results] :
Target = File
Output Format = either Column aligned or CSV/TAB delimited

I usually increase the "Max.chars per column" to 8000 as well

Kristen
Go to Top of Page
   

- Advertisement -