当我尝试在一个存储过程中更新两个表时遇到问题我得到 SqlException 有人可以帮助我吗
INSERT 语句与 FOREIGN KEY 约束“FK”冲突。冲突发生在数据库“”、表“dbo.Users”、列“userID”中。该语句已终止。
ALTER PROCEDURE [dbo].[CreateProject]
@ProjectID UNIQUEIDENTIFIER,
@UserID UNIQUEIDENTIFIER,
@ProjectName NVARCHAR(50),
@Description NTEXT,
@EstStartDate DATETIME,
@EstEndDate DATETIME,
@StatusID SMALLINT,
@Priority SMALLINT
AS
INSERT INTO DBO.Projects VALUES
(@ProjectID,@ProjectName,GETDATE(),@Description,@EstStartDate,@EstEndDate,@StatusID,@Priority)
INSERT INTO Users_projects VALUES
(@ProjectID,@UserID)