SQLCE: How to execute complex scripts
For one of the side-projects I am working on, I needed a way to execute long SQL scripts to create some reports. I started the project using SQLCE because I didn’t wanted to bother with a full installation of a SQL server (even the Express one), so I wrote all the code exploiting EntityFramework 6 and the SQL Server Compact & SQLite Toolbox. I didn’t used SqlLite because at the time EF6 didn’t had support for it (was added in February 2014, see here).
However, one of the drawbacks is the lack of support of some SQL commands, for example the syntax “SELECT … INTO … FROM”. Also, I had complex scripts that used the GO command to separate the blocks. In order to make these work, I wrote a very simple routine that splits the .sqlce file by line, searches for each GO and executes the query till that point. You can find the code here on GitHub 🙂