.NET Library for loading data fast (doing bulk inserts) into a SQL Server Compact database file. Attempts to mimic the SqlClient SqlBulkCopy API.
Switch branches/tags
Nothing to show
Clone or download
Latest commit 8e06ce8 Dec 27, 2017
Permalink
Failed to load latest commit information.
doc Adding docs (as .zip for now) Mar 31, 2017
docs Clenup Mar 31, 2017
src Small clarifications Dec 27, 2017
.gitignore Initial commit Mar 31, 2017
LICENSE Initial commit Mar 31, 2017
README.md Update README.md Mar 31, 2017

README.md

SqlCeBulkCopy

.NET Library for loading data fast (doing bulk inserts) into a SQL Server Compact database file. Attempts to mimic the SqlClient SqlBulkCopy API.

How fast is it?

Some timings from testing - load 2 column table with no constraints/indexes:

1.000.000 rows: 6 seconds = 166.666 rows/second

5.000.000 rows: 28 seconds = 178.000 rows/second

How to get it

For use with SQL Server Compact 4.0, simply install the NuGet package

The library also works with SQL Server Compact 3.5 and .NET Compact Framework see Releases

How to use it

Sample usage of the API - the WriteToServer method also accepts a DataTable, an IEnumerable or an IEnumerable

    using ErikEJ.SqlCe;

    private static void DoBulkCopy(bool keepNulls, IDataReader reader)
    {
        SqlCeBulkCopyOptions options = new SqlCeBulkCopyOptions();
        if (keepNulls)
        {
            options = options |= SqlCeBulkCopyOptions.KeepNulls;
        }
        using (SqlCeBulkCopy bc = new SqlCeBulkCopy(connectionString, options))
        {
            bc.DestinationTableName = "tblDoctor";
            bc.WriteToServer(reader);
        }
    }

Online documentation

Offline documentation