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,171 of 19,505   
   Erland Sommarskog to andrew   
   Re: Should I split the record?   
   27 Mar 11 13:31:05   
   
   From: esquel@sommarskog.se   
      
   andrew (thegroup@microsoft.com) writes:   
   > This is a newbie design question.  I have a table with the following   
   > fields   
   >   
   > TABLE A   
   > ID, Prop1, Prop2   
   >   
   > I expect that I might have multiple concurrent users accessing the same   
   > record (in a recordset via SELECT).  If I expect to have users modify   
   > either Prop1 or (XOR) Prop2 I should also expect the DB to complain   
   > since one of the users would have the record locked (I'm learning lots   
   > about locks).   
      
   This all depends on you implement the application. If you update only the   
   colunm that the user actually has changed, both changes will have effect.   
      
   Commonly, you update all columns, changed or not, and in this case one   
   change will overwrite another. There are mechanisms to prevent this from   
   happening, for instance timestamp columns. Or simply compare all columns   
   with the saved values which is what some client APIs do if you hand over the   
   responsibility to them, rather than crafting the UPDATE statements yourself.   
      
   As for the table design, it is impossible to say what is the best, as a good   
   database design is governed by several factors. In fact, I would say that   
   the particular problem you have presented carries very little weight. This   
   situations may be better handled in the application to permit concurrent   
   updates. But again, from your abstract description, it is impossible to   
   give an answer in either direction.   
      
   --   
   Erland Sommarskog, SQL Server MVP, esquel@sommarskog.se   
      
   Links for SQL Server Books Online:   
   SQL 2008: http://msdn.microsoft.com/en-us/sqlserver/cc514207.aspx   
   SQL 2005: http://msdn.microsoft.com/en-us/sqlserver/bb895970.aspx   
      
   --- 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