x

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

Fatherjack gravatar image

Fatherjack ♦♦
42.4k 75 78 108

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

1 answer: sort voted first
more ▼

answered Dec 11, 2012 at 12:25 PM

Kev Riley gravatar image

Kev Riley ♦♦
52.8k 47 49 76

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.

New code box

There's a new way to format code on the site - the red speech bubble logo will automatically format T-SQL for you. The original code box is still there for XML, etc. More details here.

Follow this question

By Email:

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

By RSS:

Answers

Answers and Comments

SQL Server Central

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

Topics:

x985
x246
x61
x38

asked: Dec 11, 2012 at 11:24 AM

Seen: 948 times

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