none
Select into CSV? RRS feed

  • Question

  • Is it possible to perform a Select Into from a DataTable to a CSV or a MSSQL database?
    Maybe by the use of TableAdapters with distributed queries, and stuff such as that...

    Most of the solutions that I have found for exporting a DataTable involve management of individual records,
    this is exactly what I'm trying to avoid, and it would provide much better performance in the apps that I'm working on.

    I though of creating creating a stored procedure that manages a distributed query, however I found myself needing to specify the table name, and I'm not sure that I can send a parameter and place it next to the from clause.

    Thank you
    Thursday, January 10, 2008 7:07 PM

Answers

  • If you need to transfer data from DataTable into CSV then you basically have two choices:

    1. Loop and output content into CSV row-by-row

    2. Dump content of DataTable/DataSet into stream using XML format and transform it into CSV using XSLT. I believe former option works faster.

     

    If you need to transfer data from SQL Server into CSV then you could use SQL Server DTS (in SQL Server 2000) or Integration Services (in SQL Server 2005) to accomplish this task. It works fast.

     

    Friday, January 11, 2008 12:12 PM
    Moderator