Bulk Insert In SQL Server CE

拟墨画扇 提交于 2019-11-27 02:54:57

问题


i am new at SQL Server CE and using Visual Studio 2008, SQL Server CE 3.5. I want to know that what the best way of inserting bulk records into SQL Server CE database? Does BULK INSERT statement work for SQL Server CE? I have nearly 45 tables and some of these tables should have large amount of data. Using command.Prepare is enough or is there more efficient and fast way?


回答1:


SQL CE does not have a bulk insert command. For the best raw performance opening a an updateable SqlCeResultset using a TableDirect SqlCeCommand is your fastest bet. It bypasses the query processor altogether, and is actually about as fast as directly writing to a text file.




回答2:


I have wrapped the bulk insert code in a NuGet library, that you can use like you use SqlBulkCopy today: http://sqlcebulkcopy.codeplex.com



来源:https://stackoverflow.com/questions/1539277/bulk-insert-in-sql-server-ce

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