由于我没有ModuleID,我想首先使用ModuleName从 Modules 表中获取。
ALTER PROCEDURE dbo.spEditTask
@ID int,
@ModuleName varchar(50),
@Task varchar(50),
@ListOfDevelopers varchar(50),
@StartDate date,
@PlannedEndDate date,
@EstimatedEndDate date,
@Status varchar(50),
@Comments varchar(500),
@LastAction varchar(50),
@Started bit
AS
BEGIN
DECLARE @ModuleID int;
SET @ModuleID =
(SELECT ModuleID
FROM Modules
WHERE ModuleName = @ModuleName);
GO
UPDATE DTasks
SET ModuleID = @ModuleID,
Task = @Task,
ListOfDevelopers = @ListOfDevelopers,
StartDate = @StartDate,
PlannedEndDate = @PlannedEndDate,
EstimatedEndDate = @EstimatedEndDate,
Status = @Status,
Comments = @Comments,
LastAction = @LastAction,
Started = @Started,
LastUpdated = GETDATE()
WHERE ID = @ID
GO
END
感谢您的帮助