Merge sql server ce databases

你说的曾经没有我的故事 提交于 2019-12-25 18:24:02

问题


Could we create a WCF Service to merge sqlserverce databases in background thread. I have GUI which selects a set of sdf databases from various directories in a network and event handler to cmd for merge the databases in those directories between the range of dates. The structure of the sdf databases are same in all the directories.


回答1:


Okay...I was trying to be funny with my comment but I will provide a better answer.

I don't know of any "magic" command to merge databases together with C# code. You could write your own logic to merge databases. The code would look something like this.

  • Get a list of tables from the database.
  • Iterate through the list of tables and grab the metadata
  • Add logic to skip any readonly columns such as identity columns and calculated fields
  • Get the data from the source table
  • Write the data to the destination table

I would really need much more information to help any more then this. For example,

  • Will you be merging all the databases into one of the original databases or will you be creating a completely new database which contains all the data from all databases?
  • Do you need to create the destination database first or does it already exists?
  • If it already exists will you need to clean up the data that already exists in the database?

Once you write the logic to do the merge, how you call the code is your choice. .Net provides the capability to call the logic from a Web Service and it provides the means to run the code in a background thread. You can implement this functionality in a variety of ways.




回答2:


This is exactly what SQL Server Integration Services was designed to do. SSIS has source and destination adapters for connecting to SQL CE.



来源:https://stackoverflow.com/questions/12351856/merge-sql-server-ce-databases

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!