1
내 조건이 결과를 반환하는 동안 업데이트를 실행하려고합니다. 문제는 쿼리를 테스트 할 때 끝나지 않습니다. 다음은 쿼리입니다.쿼리가 너무 많이 받음
While(select COUNT(*) from Agreement as agr where agr.Id in (
select toa.Id from Agreement_TemporaryOnceAgreement as toa where toa.Executed =1)
and agr.EndingDate is null) > 0
begin
DECLARE @AgreementID int;
SET @AgreementID =
(
select top 1 agr.id from Agreement as agr where agr.Id in (
select toa.Id from Agreement_TemporaryOnceAgreement as toa where toa.Executed =1)
and agr.EndingDate is null
)
update Agreement SET EndingDate = (
select tado.Date from TemporaryAgreementsDateOfExecution tado
where tado.AgreementId = CAST(@AgreementID AS INT))
where Agreement.Id = CAST(@AgreementID AS INT);
end;
어떤 rdbms를 사용하고 계십니까? – Barranka