This answer on Stack Overflow shows another way to update specific columns of a database record in Linq to SQL: Map the table in the .dbml file a second time, but omit the long columns.
using (var database = new DataContext()) { var fooID = database.FooMaxIDs .Where(foo => foo.OID == OID).FirstOrDefault(); fooID.ID = newID; database.SubmitChanges(); }
This generates the following SQL statements:
SELECT TOP (1) [t0].[OID], [t0].[ID] FROM [dbo].[FooMax] AS [t0] WHERE [t0].[OID] = @p0 UPDATE [dbo].[FooMax] SET [ID] = @p2 WHERE ([OID] = @p0) AND ([ID] = @p1)
Pingback: Batch Update using Linq To SQL « devioblog