I'm new to SQL Server and struggling to link a foreign key in one table to a primary key in another table. Here is what I have:

This is my first table

```
Create table "Employees"
(EmpID Int identity(1,1) primary key,
EmpNo Int,
EmpFName Varchar(30),
EmpLName Varchar(30),
JobID int references JobDetails(JobID)
)

```

I then created a second table:

```
Create table "Projects"
(ProjectID Int identity(1,1) primary key,
ProjectName VarChar(30),
ProjStartDate smalldatetime,
)

```

And tried to link the third table:

```
Create table "HrsWkd"
(HrsID Int identity(1,1) primary key,
ProjectID int references Projects(ProjectID),
HoursWorked int,
EmpID int references Employees(EmpID)
)

```

Incidentally, (EmpID) has a red squiggly line underneath saying that it references an invalid column in 'employees'. 

If I then try to enter data into this third table like this:

```
insert into HrsWkd values 
    (1,1,50),
    (1,2,75),
    (2,3,85)

```

I get this message:

> 
> Msg 547, Level 16, State 0, Line 12
> 
> 
> The INSERT statement conflicted with the FOREIGN KEY constraint "FK\_\_HrsWkd\_\_EmpID\_\_68487DD7".
>  The conflict occurred in database "New\_AP", table "dbo.Employees", column 'EmpID'.
> 
> 
> The statement has been terminated.
> 
> 
> 

I have been pulling my hair out with this for the last 2 hours. I'm guessing it is something simple, but I just can't see it.

Thanks!

twotoast