Update whole record or dynamic TSQL in procedure?

I am on a new project and we are looking at having a wide table and I am wondering if anyone has done any measurement of whether it is better to have a procedure to carry out an update from the web app update the whole record or to update just the column being changed?

It's a lot easier to write the procedure to update the whole record but that will start to incorrectly skew statistics and be slower if there are lots of indexes, however writing the procedure to check which column value is different and execute the T-SQL to update just that column will be quite complex and potentially sub-optimal?

I'm a stranger in developer-land so am not aware of any standards on this ...

more ▼

asked Dec 11, 2012 at 11:24 AM in Default

avatar image

Fatherjack ♦♦
43.8k 79 102 118

(comments are locked)
10|1200 characters needed characters left

1 answer: sort voted first
more ▼

answered Dec 11, 2012 at 12:25 PM

avatar image

Kev Riley ♦♦
66.8k 48 65 81

Nice one! Thanks :)

Dec 11, 2012 at 12:38 PM Fatherjack ♦♦
(comments are locked)
10|1200 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here



Answers and Comments

SQL Server Central

Need long-form SQL discussion? SQLserverCentral.com is the place.



asked: Dec 11, 2012 at 11:24 AM

Seen: 1558 times

Last Updated: Dec 11, 2012 at 12:38 PM

Copyright 2018 Redgate Software. Privacy Policy