home bbs files messages ]

Forums before death by AOL, social media and spammers... "We can't have nice things"

   comp.databases.ms-sqlserver      Notorious Rube Goldberg contraption      19,505 messages   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]

   Message 18,219 of 19,505   
   Gene Wirchenko to All   
   SSE 2008: Trigger: Modifying Data to be    
   08 Apr 11 15:11:13   
   
   XPost: microsoft.public.sqlserver.programming   
   From: genew@ocis.net   
      
   Dear SQLers:   
      
        How do I modify the data that is going to be written to a table?   
      
        I understand that this data is in a logical table called   
   inserted, but that this data can not be modified.  I really would like   
   to.   
      
        I want to put a filter in between to clean up the data.  The   
   procedure that I posted recently that cleans up strings would be   
   useful here.  I would like to invoke this in the trigger.   
      
        For example, with my table Accounts, if ACName is entered as   
             "   Account     Name    "   
   I would like this to be cleaned up to   
             "Account Name"   
   and the latter value be the one written to the table.   
      
        Since I can not write to the inserted logical table, I do not   
   know how to do this.   
      
        One idea is to disallow application write access to Accounts,   
   have a shadow table that is written to and in its trigger, process its   
   rows and write accordingly to Accounts.  This seems rather   
   complicated.  I hope that there is a better way.   
      
   Sincerely,   
      
   Gene Wirchenko   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]


(c) 1994,  bbs@darkrealms.ca