0

I want to recreate the following SQL Update Command in LINQ to DB (Linq2DB).

UPDATE MyTable
SET TextColumn = CONCAT(TextColumn, char(13), char(10), 'New Text')
WHERE TextColum IS NOT NULL

I don't know how to implement this with Linq2Db because I don't know how to get access to the Column to use it as a Value.

using (var db = new DbNorthwind())
{
  db.MyTable
    .Where(p => p.TextColumn != null)
    .Set(p => p.TextColumn, ???)    
    .Update();
}
SuperGURU
  • 25
  • 5

1 Answers1

2

Nothing special here, just repeat what to do with column.

using (var db = new DbNorthwind())
{
    db.MyTable
        .Where(p => p.TextColumn != null)
        .Set(p => p.TextColumn, p => p.TextColumn + "New Text")    
        .Update();
}
Svyatoslav Danyliv
  • 21,911
  • 3
  • 16
  • 32
  • 1
    Thanks a lot! Sorry my Visual Studio apparently got confused yesterday. Today everything works, as you showed. Thanks for the great work with Linq2Db, really love it! – SuperGURU Oct 13 '22 at 11:10