如何在批量插入后将数据插入 SQL CE 数据库?

How to insert data into a SQL CE database after a bulk insert?

我正在使用 ErikEJ 的 SQL CE Bulk Copy library to copy the contents of one database into another. The problem is, after the bulk copy is complete, AUTOINC_NEXT in INFORMATION_SCHEMA.COLUMNS is still just equal to 1 for all primary key columns, causing a duplicate key exception when I try to insert a new row somewhere. Is there a way to make SQL CE Bulk Copy automatically update AUTOINC_NEXT to an appropriate value? Or alternatively, is there some utility I can use to manually edit it? (I've tried CompactView,但它只是给出错误 "Data cannot be updated in a system table or a schema information view.")

听起来你发现了一个错误!我会仔细看看的。 https://sqlcebulkcopy.codeplex.com/workitem/25951

修正为:

ALTER TABLE [MYtable] ALTER COLUMN [Id] IDENTITY (1001,1);