SQL Server CE .sdf merge

2019-09-02 05:53发布

问题:

My application is running on Windows CE 6.0, and it uses a SQL Server CE .sdf file to store user data. The application is running on an industrial device, which is not connected to internet. The only way to update the software is to plug a USB stick inside.

As expected, the first release 1.0 of the application needs to update to 1.1 now, the database schema as well.

How could I merge the .sdf version 1.0 which is on the device with the latest 1.1 database schema that will be available through the File System (USB stick) of the device.

I added a picture below to help understanding my question.

I am aware about RDA and Merge Replication possibility, but my application is not connecting to a central server through http. Before learning how to use them I would like an expert advice.

回答1:

You will need to programatically apply the changes required for the schema to change from 1.0 to 1.1. You can do this by using ALTER TABLE/CREATE TABLE statements, combined with inspecting the current schema by querying the INFORMATION_SCHEMA views