From: genew@ocis.net   
      
   On Sun, 10 Apr 2011 14:48:15 +0200, Erland Sommarskog   
    wrote:   
      
   >Gene Wirchenko (genew@ocis.net) writes:   
   >> 2) I think that maintainability was covered by the code I borrowed   
   >> from. My derivative has   
   >> select * into #Inserted from Inserted   
   >> at the beginning and then at the end, writes with   
   >> insert into Accounts select * from #Inserted   
   >   
   >That should work. One of the few situations where SELECT * in production   
   >code could be defended.   
   >   
   >Unfortunately, it will not work if the table has an identity column, a   
   >timestamp column or a computed colunm.   
      
    Ouch! What should I do then? I will be pondering this. I am   
   working to come up with as general a solution as possible to data   
   cleaning and validation.   
      
   >I have also experienced performance problems with using SELECT INTO in a   
   >trigger which was written to handle multi-row inserts, but the transaction   
   >at hand was a loop that did things one-by-one. I found by testing that   
   >SELECT INTO was more expensive that using CREATE TABLE #temp, which in its   
   >turn was more expensive than table variables. Then again, this was on SQL   
   >2000, and it is possible that the temp-table caching in later versions   
   >alleviates the problem. I haven't come around to test that.   
      
    I have to consider how to handle multi-row operations, too.   
      
    There is no shortage of things to learn. One of these things is   
   learning what I have to learn.   
      
   Sincerely,   
      
   Gene Wirchenko   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   
|