Export to cvs format.

5 views
Skip to first unread message

marifdu

unread,
Jan 14, 2008, 8:12:13 AM1/14/08
to CSVChat
How can i export my sql server Data to cvs format.
I did't find any solution to export data from c#.net to cvs format.
Arif

shriop

unread,
Jan 14, 2008, 9:08:12 AM1/14/08
to CSVChat
I'm assuming that you mean csv format, instead of cvs. There is no
built in way in c# to pull data from sql server and save it out as
csv. If you don't have a need to use c#, you can just use the sql
server 2000 import/export wizard, or the sql server 2005 import/export
wizard. If you want to automate it, you would use dts in sql server
2000 or ssis in sql server 2005. To actually use c#, you can use
CsvWriter from http://www.csvreader.com. The exact c# code depends on
how much data you have. If it's a fairly small amount of data, you can
load into into a DataTable and then use the WriteAll method to write
the contents out to the csv file. If it's a large amount of data,
you'll have to loop over each column for each row and call the Write
method to write each field.

Bruce Dunwiddie
Reply all
Reply to author
Forward
0 new messages