我需要更新特定人群的表。
代码:
@IdentityNumbers dbo.StringList readonly
update d
set DeliveryNationalInsuranceBatchLogId = @BatchLogId,
LastUpdateDate=getdate(),
LastUpdateUserId=-999
from MortgageDetails d join MortgageReturnParticipationBase b
on b.Id = d.MortgageReturnParticipationBaseId join @IdentityNumbers newRow
on (newRow.item = b.IdentityNumber or newRow.item = b.MateIdentityNumber)
where (DATEADD(YEAR,70,BirthDate) <= getdate() or (MateBirthDate is null or DATEADD(YEAR,70,MateBirthDate) <= getdate()))
and b.CheckWithNationalInsurance=1
and d.IsActive=1
and b.MortgageReturnParticipationStatusId=1
我做到了,它只需要几秒钟到一分钟就可以容纳大约10,000名董事会成员,而大约500,000名需要一个小时...
我认为原因是此StringList减慢了速度...
这真的是问题吗?有解决办法吗?