What is the best way to handle updating multiple columns


If I have a profile form with 20 fields a user can update on a page. It seems like it would be a waste to run an update statement that would update every single column if the user only changed two fields.

I was wondering what would be the best way to handle this for the best performance.

Since I only have 20 fields its not really an issue but I am just wondering for future development of where maybe it could be more.

What does everyone else do, do you just update every column for that row?

Tools like Entity Framework (or other ORM tools) will handle this for you, for "free".

They track what has changed in your objects, and they will issue a tailor-made UPDATE statement that will only update those columns that have actually changed.

You need not worry about any of those details anymore. All taken care of for you. Try it!