I am using SQL Server Compact Edition.
I have a FOR loop for build my queries to insert data so I download as 3000 rows from a full-blown SQL Server.
I need to insert these 3000 rows into SQL Server Compact Edition, and currently I do an insert for every row which takes a lot of time. I need to do this for 12 tables, and that would take a very long time… I need a faster method to do this in less than 5 minutes…
Do you know any way for to get a insert a lot of rows on SQL Server Compact?
I tried do insert of fifty on fifty but I got an ERROR…
insert into table(col1,col2)
values (val1,valo2) ;
insert into table(col1,col2)
values (val1,valo2)
I got error with 2 insert (so its not going to be able for to do 50 inserts),
Is it possible to do OPENROWSET in SQL Server Compact Edition?
MY QUESTION
How can I insert a lot of rows into a SQL Server Compact Edition database?
I get this data from a full-blown SQL Server database.
See below for what I think is the best solution, but if you don’t like it (for whatever reason) and your source database is SQL Server you could consider making a linked server in SQL Server to your compact database and letting SQL Server insert the records. From my experience, SQL Server inserts into arbitrary databases pretty quickly.
SQL Compact Bulk Insert Library