如果我在SQL Server 2008中使用以下SQL命令更新一个带有外键约束的表:
ALTER TABLE Employees
ADD FOREIGN KEY (UserID)
REFERENCES ActiveDirectories(id)
UserID
是我在 Employees
表中的外键列。 我试图引用 ActiveDirectories
表中的 UserID
。我收到以下错误:
外键 'UserID' 引用了参考表 'Employees' 中的无效列 'UserID'。