> Stewart
>
> How many records are there in cWrkOrdr and how long does it take.
>
> Instead of putting some conditions in the WHERE, I think you can put them in the JOIN
> Like
> UPDATE mrs_dtl SET tl_rtn = cWrkOrdr.rtn_qty;
> FROM mrs_dtl;
> INNER JOIN cWrkOrdr ON mrs_dtl.mrs_no = cWrkOrdr.mrs_no;
> WHERE cWrkOrdr.part_code = mrs_dtl.son_code;
> AND cWrkOrdr.prd_ordr = mrs_dtl.prd_ordr;
> AND cWrkordr.rtn_qty > 0
> can be
> UPDATE mrs_dtl SET tl_rtn = cWrkOrdr.rtn_qty;
> FROM mrs_dtl;
> INNER JOIN cWrkOrdr ON mrs_dtl.mrs_no = cWrkOrdr.mrs_no;
> AND cWrkOrdr.part_code = mrs_dtl.son_code;
> AND cWrkOrdr.prd_ordr = mrs_dtl.prd_ordr;
> WHERE cWrkordr.rtn_qty > 0
>
> You should have all the required indexes in place whereever you have the "=" sign.
>
> in mrs_dtl you need indexes on son_code, prd_ordr, mrs_no
> in cWrkOrdr you need it on part_code, prd_ordr, mrs_no, rtn_qty
>
> Also you can enclose everything in a BEGIN TRANSACTION / END TRANSACTION.
>
> HTH
>
> Regards
> Tushar
>
>
Dear Expert,
Can you give some example? I'm not familiar to use BEGIN TRANSACTION / END TRANSACTION.
Thanks.
Regards,
Stewart Chew