| 
	
 | 
 Posted by Erland Sommarskog on 07/19/06 21:50 
(dwightsmail@gmail.com) writes: 
> What i want to know is if there is a relatively simple way of using a 
> query to populate the 10 hazards to each department, and to also 
> include the related table links, i dont mind renaming the departments 
> names to match each hazard, but i do not want to have to relink the 
> related tables manually 
 
INSERT Hazards(HazardID, Hazard, Department) 
   VALUES (1, 'Fog', 'This Dept') 
 
Oh, so this won't work, because you have an IDENITY column, but it 
will be a lot easier if you don't have an IDENTITY. 
  
> Consequences 
> ---------------------- 
> ConsequenceID - identity key field 
> HazardID - FK 
> Consequence - varchar 
  
If there can be more than once consequence per hazard, I think the key 
should be (HazardID, ConsequenceNo). 
 
 
--  
Erland Sommarskog, SQL Server MVP, esquel@sommarskog.se 
 
Books Online for SQL Server 2005 at 
http://www.microsoft.com/technet/prodtechnol/sql/2005/downloads/books.mspx 
Books Online for SQL Server 2000 at 
http://www.microsoft.com/sql/prodinfo/previousversions/books.mspx
 
  
Navigation:
[Reply to this message] 
 |