Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Inserting Data - Foreign key error

Author  Topic 

gemispence
Yak Posting Veteran

71 Posts

Posted - 2006-02-17 : 17:08:38
How do I go about inserting records on a table that has a PK/FK relationship with another table?? I get a foreign key error everytime I try :)

TG
Master Smack Fu Yak Hacker

6065 Posts

Posted - 2006-02-17 : 17:32:39
You need to make sure the "parent" table has the primary key value before attempting to insert that value into the "child" table.

so for example you can't insert an employeeid to a workhours table until the employeeid exists in the employee table.

Be One with the Optimizer
TG
Go to Top of Page
   

- Advertisement -