I have this stored procedure, which has been working for a little while
CREATE PROCEDURE `ProjectFromTemplate`(
IN TemplateID INT,
IN NewProjectID INT
)
BEGIN
INSERT INTO Project_Stage
(
ProjectID,
StageID,
StageIndex,
Time
)
(
SELECT
NewProjectID,
StageID,
StageIndex,
Time
FROM Project_Stage
WHERE ProjectID = TemplateID
);
END
But I decided to add another column to the table, but I didn't update the procedure accordingly. I would like the procedure to be able to handle any new rows that I add. I need something like this pseudo-SQL
CREATE PROCEDURE `ProjectFromTemplate`(
IN TemplateID INT,
IN NewProjectID INT
)
BEGIN
INSERT INTO Project_Stage
(
ProjectID,
*
)
(
SELECT
NewProjectID,
*
FROM Project_Stage
WHERE ProjectID = TemplateID
);
END
Is there a way to express something like 'all the subsequent rows' in MySQL?