I have table with more than 25 Fields in it. It has some column with huge data (nvarchar(MAX)
). It has User table like :
ID // Primary key
Name
Mail
Contact
RegFees
.
.
. // about 25 Fields
Narration // Nvarchar(Max) may have upto 10000 chars
Tag // Nvarchar(Max) may have upto 15000 chars
Now i have to update only Name,Mail,Contact fields in it.
I have gone through several so posts like update 1 field, update multiple fields. But these require data to be loaded for that specific user ID and then Update it like :
var u = dc.Users.Where(a =>a.ID.Equals(i.ID)).FirstOrDefault();
if (u != null)
{
// Note : ALL the data of 25+ columns is loaded including nvarchar(Max)
// it will decrease performance as Whole Data is loaded first.
u.Name = i.Name;
u.Mail = i.Mail;
u.Contact = i.Contact;
}
is there any better way that does not require to load entire data ?