locked
Copy contents from SQL Server table to SqlCe RRS feed

  • Question

  • I have looked at the other posts on copying data into SQLCe however it just seems like there should be a cleaner way.  I have a remote SQL server I connect to and get a tables contents.  I have a local SqlCe that I want to put that in.  The tables are the same.  Is there a way to do a bulk insert between the two?  I could load a datatable or something and use that. Just seems like to close of a match to have to loop through the records.
    Monday, March 5, 2012 11:53 PM

Answers

All replies

  • Hi Voast Dev,

    If you don’t want to create an application to retrive and insert data, I think you can use SQL Server Integration Services (SSIS) use SSIS to transfer data efficiently.

    Please see: http://technet.microsoft.com/en-us/library/ms403372.aspx

    You may also refer to ErikEJ’s blog post to migrate a SQL Server database to SQL Server Compact and then copy data with INSERT&SELECT:

    http://erikej.blogspot.com/2010/02/how-to-use-exportsqlce-to-migrate-from.html 


    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    Get or Request Code Sample from Microsoft
    If you have any feedback, please tell us.

    • Edited by KJian_ Wednesday, March 7, 2012 5:47 AM
    Wednesday, March 7, 2012 5:46 AM
  • I am saying that I do want to do this in code.  I just think between SQL Server and SqlCe there should be some kind of couple table.  There is a bulk copy but I can't get it to work between the two databases.  My application pulls down several tables from a larger SQL database and places all the data in a local SQL Ce database.  It runs off that as a smaller local copy.  I want to do this to several tables so a bulk copy method between the 2 would be great for me.
    Wednesday, March 7, 2012 2:08 PM
  • I think you can use my SQL Server Compact bulk copy library: http://sqlcebulkcopy.codeplex.com

    Please mark as answer, if this was it. Visit my SQL Server Compact blog

    • Marked as answer by KJian_ Monday, March 12, 2012 6:32 AM
    Wednesday, March 7, 2012 7:26 PM