Some time ago I wrote the series "How to import data to SQL Server compact edition Database" ArticleThis section describes how to import data from the SQL Server database to the SQL Server compact database, attracting a lot of attention. Today, I saw a great tool in codeproject, which can directly generate SQL Server compact 7.0/2000/2005 databases from SQL Server 3.1/3.5 databases, the generated SQL Server compact database contains the primary key, foreign key, index, and data of the source data.
I have a brief look at its core.CodeThe schema obtained from the source database is implemented using SQL Server Management Objects (SMO) of SQL Server 2005. It is not difficult to generate an SQL script for database creation after the schema is created.
However, when I generate a corresponding SQL Server compact 2000 database for the SQL Server 3.5 northwind database, some tables may encounter errors when copying the database, which may be because they have not processed the image fields. To be compatible with SQL Server compact 3.1 and 3.5, reflection technology is used to create instances of the type in the system. Data. sqlserverce namespace. We recommend that you download the code for research. I will not go into details here.
Original article: SQL Server to SQL Server compact edition database copy Utility
SMO documentation: http://msdn.microsoft.com/zh-cn/library/ms162169.aspx