f7264981   
   From: genew@ocis.net   
      
   On Thu, 10 Feb 2011 16:38:22 -0800 (PST), migurus    
   wrote:   
      
   >This is SQL Server 2005, we have an application written in such a way   
   >that all updates are done on all columns of a table subject to change,   
   >even though only one field needs to be modified.   
   >   
   >For example:   
   >   
   >create table #T (   
   >CID INT,   
   >DT DATETIME,   
   >QTY INT);   
   >   
   >INSERT INTO #T   
   >select 1, '20110210 12:10', 10 union all   
   >select 2, '20110210 12:20', 10 union all   
   >select 3, '20110210 12:30', 30 union all   
   >select 4, '20110210 12:40', 40   
   >   
   >-- we need to change quantity to 0 on row with CID=2   
   >-- app produces this sql:   
   >   
   >update #T   
   >set CID=3,DT='20110210 12:30',QTY=0   
    ^   
    Based on the comment above, this should be "2".   
      
   >where CID=3   
   >   
   >My question - how bad is it? in real tables some colums are indexed,   
   >does it make server to try to modify indexes? Is SQL Server smart not   
   >to update columns whose value was not changed?   
      
    Why are you worrying about this? Is it running too slow for you?   
      
    The internal details are likely beyond your control. Just let   
   the DBMS do its job.   
      
   Sincerely,   
      
   Gene Wirchenko   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   
|