BEGIN TRANSACTION
BEGIN TRY
;WITH CTE_TQUOTEWO
AS
(
SELECT WORKID,QUOTE_NO
FROM ABC_TQUOTEWO WITH(INDEX(PK_TQUOTEWO_ID))
WHERE TQUOTEWO_ID != ''
)
DELETE CA
FROM CTE_TQUOTEWO CA
JOIN I_ABC_TQUOTEWO AT WITH(INDEX(PK_ITQUOTEWO_ID))
ON AT.WORKID = CA.WORKID
AND AT.QUOTE_NO = CA.QUOTE_NO
AND AT.TQUOTEWO_ID != '';
COMMIT TRANSACTION
END TRY
BEGIN CATCH
ROLLBACK TRANSACTION
END CATCH
我有一个包含数百万条记录的表,并且没有定义索引,但执行仍然需要很多时间。任何人都可以建议更快地执行删除操作吗?使用 sql 服务器...