how to insert results to sql table? (Specifically where to reference destination table)

Looked at a few examples to insert data(links below) but dont see the syntax to reference the destination table.

Whats the LINQ version of INSERT INTO Table2 based on SQL code below?
--append to table INSERT INTO table2 SELECT * FROM table1


  • This is the simplest I can come out with:

    var NewTable2Entities = Table1.Select(Table1Entity => new Table2Entity() {Property1 = Table1Entity.Property1, Property2 = Table1Entity.Property2}); Table2.InsertAllOnSubmit(NewTable2Entities); SubmitChanges();

    Give it a try!
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!