XPost: microsoft.public.sqlserver.programming   
   From: genew@ocis.net   
      
   On Mon, 11 Apr 2011 14:55:38 -0400, "Bob Barrows"   
    wrote:   
      
   [snip]   
      
   >It is not a matter of wanting all the columns. It is a matter of writing   
   >maintainable code that will not blow up just because a new column is added.   
      
    Ironic.   
      
    In your scenario, if a column is added and the trigger is not   
   modified, the table will not be properly updated because of the   
   missing column.   
      
    In mine, the update will still work.   
      
   >I disagree that listing all the columns makes code less maintainable.   
      
    It means that it is not obvious that an column was missed, and in   
   this case, one always wants all columns.   
      
   >An example where using selstar caused one of my colleagues to spend an   
   >afternoon trying to fix a "bug" in his application occurred when he created   
   >a view that used it, never expecting that he would have to recompile the   
   >view to get it to return columns added after the initial compilation.   
      
    I have not used views yet. Your point certainly is worth   
   considering there. I do not disagree that selstar is usually a Bad   
   Thing, just that it is not always so.   
      
   >I've tested a trigger that uses selstar to select into a test table and it   
   >does seem to behave as you want it to behave, not needing a recompile after   
   >adding a column to the trigger table, so it should work as you desire   
   >providing you solve the other problems Erland pointed out..   
      
    Yup.   
      
    Thanks for your posts even if we are disagreeing somewhat.   
      
   Sincerely,   
      
   Gene Wirchenko   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   
|