I have created a Data Access Layer using .NET. Everywhere that I update a database record, I have used sql along the lines of
UPDATE Customer SET FirstName=:FirstName, LastName=:LastName, Address1=:Address1, Address2=:Address2,....etc
This means that every field in the record is updated, even though only one field may have been changed. A colleague has taken issue with this, saying that we should only update a field if it has changed, citing bandwidth as the issue - say we had 160 fields, then we pass the data for 160 fields. I guess I could save bandwidth between the web server and the database server if I checked whether a value had changed, and generated sql based purely on the values that were actually changed.
Between the web server and the client, I now need to pass both old and new values, so potentially I increase bandwidth there (but then ASP.NET does this already anyway, and I'm not sure we can switch that bit off so that's probably not an issue).
So what is best practise? Should I be worried about updating all fields in a database record? How would I go about updating only the fields that have changed?
Edit added 29 October: Does anyone know what NHibernate does? Perhaps this is an argument to invest time learning how to do it that way.