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,220 of 19,505   
   Bob Barrows to Gene Wirchenko   
   Re: SSE 2008: Trigger: Modifying Data to   
   08 Apr 11 18:44:47   
   
   XPost: microsoft.public.sqlserver.programming   
   From: reb01501@NOSPAMyahoo.com   
      
   Gene Wirchenko wrote:   
   > 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,   
   >   
   You can use an INSTEAD OF trigger - see Books OnLine   
      
   --- 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