I have 800 records in a table, I used trigger to update more than 20 fields from 4 tables but very slow takes up to 25 sec to update changes, i know computed fields are faster but i cant use computed fields to get/ update fields data from another table. what other methods can i use?
below i tried to show is how i am trying to updating field
create TRIGGER [dbo].[WO-WHLINFO]
ON [dbo].[WORKORDERS]
AFTER INSERT,UPDATE
AS
BEGIN IF TRIGGER_NESTLEVEL() > 1
RETURN UPDATE T1
SET [C/S ANGLE2]=T2.[C/S ANGLE2],
[BH SIZE2]=T2.[BH SIZE2],
[COLOR]=T2.[COLOR],
[MRP Wheel]=T2.[STOCK NO],
[WO PN]=T2.[WHL-ASSY LOOKUP]
FROM WORKORDERS T1 CROSS APPLY (SELECT TOP 1 *
FROM [WHl] T2
WHERE [WHEEL PN 1]=T2.[WHL-ASSY LOOKUP] OR
[WHEEL PN 1-S]= T2.[STOCK NO]) T2
END
what other options i can use to update field data from another table?
请尝试在表上创建索引,这可能会增加插入和删除的速度
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.