Is there any easy way to create individual SQL INSERT
statements from each row of the results of a SELECT
query in Linqpad, other than concatenation?
有没有简单的方法从Linqpad中的SELECT查询结果的每一行创建单独的SQL INSERT语句,而不是连接?
This is close to what I want but I don't think it accepts a SQL SELECT
string as input.
这接近我想要的但我不认为它接受SQL SELECT字符串作为输入。
This is also close to what I want but the output isn't individual INSERT
statements.
这也接近我想要的但输出不是单独的INSERT语句。
1 个解决方案
#1
1
You can use DumpAsInsert
from your first suggestion.
您可以在第一个建议中使用DumpAsInsert。
Because DumpAsInsert
uses the IEnumerable
more than once, you have to instantiate the query into memory:
因为DumpAsInsert多次使用IEnumerable,所以必须将查询实例化到内存中:
var sel = this.ExecuteQuery<Accounts>(@"Select * from Accounts Where Actid < 100").ToList();
sel.DumpAsInsert("Accountscopy", "Actid");
#1
1
You can use DumpAsInsert
from your first suggestion.
您可以在第一个建议中使用DumpAsInsert。
Because DumpAsInsert
uses the IEnumerable
more than once, you have to instantiate the query into memory:
因为DumpAsInsert多次使用IEnumerable,所以必须将查询实例化到内存中:
var sel = this.ExecuteQuery<Accounts>(@"Select * from Accounts Where Actid < 100").ToList();
sel.DumpAsInsert("Accountscopy", "Actid");