Database Design Has A relationship with Surrogate Key

dwermprearf

New Member
First I want to be able to update all attributes/fields and there is no single unique key. I have a heirarchy like each PC can be categorized as PC1/PC2/PC3 can't give example and each PC has Network and Software Info. Design and examples are \[code\]Parent Table PC(EmpName, PCName, HostName,.... PhysicalLocation, PCType)\[/code\] \[code\]EMPName,PCName,PCType\[/code\] combinely make this table unique.example record \[code\]('XYZ', 'Work Laptop','XYZ-PC',.....,'DESK-123','PC1')\[/code\]Child Table \[code\]PCNetwork(EmpName, PCName, HostName,IPAddr,....,PhysicalLocation,PCType)\[/code\]\[code\]example record1 ('XYZ', 'Work Laptop','XYZ-PC','0.0.0.0',....,'DESK-123','PC1')\[/code\]\[code\]example record2 ('XYZ', 'Work Laptop','XYZ-PC','0.0.0.1',....,'DESK-123','PC1')\[/code\]Since I want all fields to be modifiable I have added Surrogate Key Id column to both. I have used PC-Id as fk to Network table but while inserting I would have to write a query to get the Id from PC table. There are two problems, if I use natural/composite key I can't do update on every record since the updates are done through Asp.Net Gridview which doesn't allow primary key updates.If I use Surrogate Key, there is a possibility of duplicate records and I can't refer them or put foreign key constraint to other fields since they can be unique only by combining all three fields.I am using SQLServer 2008 and ASP.Net 4.0I am missing something for sure, can anyone help or suggest a good design for this. Thanks!!
 
Back
Top