How do I export SQL Table Data? RRS feed

  • Question

  • How do i go about exporting an SQL Table or Query's data via VS 2008 c#?

    Wednesday, September 3, 2008 3:25 AM

All replies

  • You will have to execute the Query :


    Select * From <Table Name> from C#. Store the result in a datatable and then load it on the target(whatever you want to load to).


    So steps will be :

    1. Create a SQLConnection to database

    2. Create the SQL Command with the query

    3. Execute the command

    4. Store resultant on SQLReader

    5. Load SQL Reader data on to target



    Hope this helps...



    Girija Shankar


    Wednesday, September 3, 2008 7:57 AM
  • Export to what? Another database? Text file? XML?


    Wednesday, September 3, 2008 4:43 PM
  • Text file, Tab deliminated preferred.


    Thursday, September 4, 2008 2:19 AM
  • See my last response in the following link:




    If you want a tab delimited file then you will probably need to use a schema.ini file to define that. Without a schema.ini file the default delimiter will be a comma.

    Thursday, September 4, 2008 1:19 PM