嗨,此语句在存储过程中执行。我正在传递参数,它正在执行多次更新和插入。我会很感激一些建议来提高性能,减少执行时间和改进代码结构。共有三个不同的表:Table_01、Table_02、Table_03。
INSERT INTO Table_01(
TestID,
TestData,
CurrentDate,
UserID,
Status
) VALUES (
@testID,
@testData,
@iDateTime,
@userID,
@Status
)
IF (@Status = 1)
BEGIN
DELETE FROM
Table_02
WHERE
TestID = @testID
UPDATE Table_03
SET
Status = 1,
Date = @iDateTime,
Work = 0
WHERE
TestID = @testID
END