If I am using the following SQL command in SQL Server 2008 to update a table with a foreign key constraint:
ALTER TABLE Employees
ADD FOREIGN KEY (UserID)
REFERENCES ActiveDirectories(id)
UserID
being my FK column in the Employees
table. I'm trying to reference the UserID
in my ActiveDirectories
table. I receive this error:
Foreign key 'UserID' references invalid column 'UserID' in referencing table 'Employees'.