You are here: Re: query to populate child table « MsSQL Server « IT news, forums, messages
Re: query to populate child table

Posted by dwightsmail on 09/25/33 11:53

I am getting close to understanding that, but how do I take the
consequence and control table information with the hazard insert? Will
the related consequences be inserted with the 'Fog'?

Thank you for helping me

I dont want to have to enter the hazards 80 times if I can learn this
skill

:)


Erland Sommarskog wrote:
> (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]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация