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
 Import/Export (DTS) and Replication (2000)
 How to create the CSV file from query?

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2003-11-10 : 07:16:23
Goutam writes "Can we create the CSV file from query. I am using 2 alternatives
1) By osql utility, creating CSV but not getting proper format
2) Another way is creating DTS package and do the transformation.

Let me know is there any better way to accomplish the objective

Goutam"

robvolk
Most Valuable Yak

15732 Posts

Posted - 2003-11-10 : 07:29:03
You can also use bcp to output a CSV formatted file (or any delimiter, or fixed-width). It is a command-line utility like osql but is designed specifically for outputting data to files. Books Online has more information on bcp.
Go to Top of Page

Merkin
Funky Drop Bear Fearing SQL Dude!

4970 Posts

Posted - 2003-11-10 : 07:50:34
Or you could use the FOR XML clause on your query and an XSL transformation to create a CSV file.


Damian
Go to Top of Page

robvolk
Most Valuable Yak

15732 Posts

Posted - 2003-11-10 : 07:53:27
Yeah, but then you'd also have to write your own custom regular expression parser and TCP/IP stack program too.
Go to Top of Page
   

- Advertisement -