Reputation: 1444
Let's say we want to insert some data from one table to another in SQL. We would do something like this:
INSERT INTO tableY
SELECT name, type, <other fields>
FROM tableX;
Here we can conveniently omit the ID from tableX being inserted to tableY, if it's an auto-generated column.
How would you do that in LINQ? I know you can get a list of items from tableX and iterate and do that. But can we do that using a single LINQ Query, without iterating?
Upvotes: 0
Views: 1244
Reputation: 18387
It seems that Linq to Entities does not provide a way to that. You can check in here:
https://stackoverflow.com/a/9221551/1384539
On the same thread, there's a suggestion to do that, I hope it could help you:
https://stackoverflow.com/a/11974858/1384539
Upvotes: 2