Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Insert into #tmp table using lin2db

Tags:

linq2db

I have a set of tables I need to run some queries against. 2-3 tables used are the same so makes sense to create a tmp table (limited access to the server so no views, stored proc solutions please). Any idea how to achieve that using linq2db? TIA

like image 764
basilklochko Avatar asked Jul 25 '26 21:07

basilklochko


1 Answers

using (var db = new DataConnection()
{
    var tempTable = db.CreateTable<MyTempTable("#tmp");

    (
        from t in ...
        select t...
    ).Insert(tempTable, t => new MyTempTable { Field1 = t.... });
}
like image 107
IT. Avatar answered Jul 28 '26 15:07

IT.



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!