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 17,785 of 19,505   
   Erland Sommarskog to wackyphill@yahoo.com   
   Re: Many to many table design question   
   15 Mar 10 23:03:45   
   
   833cd176   
   From: esquel@sommarskog.se   
      
   wackyphill@yahoo.com (wackyphill@gmail.com) writes:   
   > Sorry, the term was vague. Yes property as in real estate location :)   
   > A property can have multiple maintenance men. I believe all three   
   > fields need to make up the Primary Key for Employee_Role_Property. I   
   > can imagine the same employee at a property having multiple roles, so   
   > that would be necessary, correct?   
      
   I think Bill's suggestion is quite on target, and, yes, it seems that   
   all three columns should be the PK.   
      
   One thing to consider is that if there are two people in the same role   
   for the same property, one of them may be the main responsible, which   
   could call for a "ismainreponsible" column, together with a unique   
   filtered index(*) on "(role, property) where is mainresponsible = 1".   
      
   But this may not at all be the case. I only mention this, because when   
   I have encountered such relation there has often been an "isdefault" or   
   "ismain" flag.   
      
      
   (*) Filtered indexes is a new feature in SQL 2008, and for SQL 2005 you   
   would have to code the same condition in some different (and more   
   kludgy) way.   
      
      
      
   --   
   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   
   SQL 2000: http://www.microsoft.com/sql/prodinfo/previousversions/books.mspx   
      
   --- 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