Friday, February 24, 2012

Bulk import data to SQL Mobile

Hi!.

Is there something like BCP utility in SQL CE?

I need to import (pereodicaly) large ammount of data to my CE database. When tested import on network this take a lot of time. That's why decided to send raw data in ASCII files (because of small size) and to import files to CE database.

Certainly, it's not a problem to write those cli by myself, but it's interesting if someone already did this...

Thanks, Sandr

There isn't a bulk import utility as you might think about BCP, but you do have a couple of options.

1. if the goal is to load a "starter" SQL CE database with schema and initial data, you can setup a simple merge replication with SQL Server 2000 or 2005 and use the AddSubscription(AddOption.CreateDatabase). When you do the first replication, the database is created for you dynamically and rows are populated from the server

2. use remote data access to pull the tables you need from the server with tracking turned off.

3. use SQL Server 2005 Integration Services to perform the data load and any transformations. The only downside to this is the destination tables must exist already in your SQL CE database.

4. write a simple CSV loader in your mobile app to load the data from files you deploy to device as content along with your project. an important performance tip - use a parameterized INSERT statement, call Prepare on the INSERT command the first time you use it, and then reuse this same command on subsequent rows.

Darren

|||does SqlBulkCopy work with SQLEv?

No comments:

Post a Comment