Orc.DbToCsv

NameBadge
ChatJoin the chat at https://gitter.im/WildGums/Orc.DbToCsv
DownloadsNuGet downloads
Stable versionStable version
Unstable versionUnstable version
Find the source at https://github.com/WildGums/Orc.DbToCsv.

This library’s sole purpose is to extract data from a MS SQL database into csv files. Each table or view will have a corresponding csv file.

The repository contains a library, a command line utility and a task runner

Usage

In order to extract the data the library needs a project file. A project file is simply an xml file with an “.iprj” extension, and looks like:

<Project xmlns="http://wildgums/2015">
  <ConnectionString>Data Source=.\SQLExpress;Initial Catalog=MyDbName;Integrated Security=True;Pooling=False</ConnectionString>
  <MaximumRowsInTable>500</MaximumRowsInTable>
  <OutputFolder>C:\Temp\CustomPath</OutputFolder>
  
  <Project.Tables>
    <Table Name="MyTable1"/>
    <Table Name="MyTable2" Csv="Table2.csv"/>
    <Table Name="MyTable3" Csv="Table3.csv" Output="C:\Temp"/>
  </Project.Tables>
</Project>

There are four important tags:

Note:

Once the project file is setup you can create the csv files using the following command:

public static void ProcessProject(string projectFilePath, string outputFolderPath, ILogWriter logWriter)

Example:

Importer.ProcessProject(projectFilePath, outputFolderPath, new ConsoleWriter());

The parameters are:

Command line utility (Orc.DbToCsv.Console)

Orc.DbToCsv.Console is a simple command line utility.

There are two possible command line options:

Example:

Orc.DbToCsv.Console.exe -p E:\sample1.iprj -o D:\output

Task Runner

TaskRunner


Contributions

We would like to thank the following contributors:

Want to contribute to the documentation? We have a guide for that!


Questions

Have a question about Catel or WildGums controls? Use StackOverflow with the Catel tag!