Forum Discussion
shuhn1229
Resolver I
1 year agoAzure Upsert Activity very slow with trigger
Hi all, I a new to ADF and Azure SQL so please be patient. I have an azure sql table and I created the following trigger to modify a last modified date column in azure sql if a copy activity usin...
Anonymous
1 year agoNot applicable
Hi shuhn1229,
Thank you for reaching out to the Microsoft Fabric Forum Community.
CREATE TRIGGER TR_wrsh_ModifiedDate
ON [dbo].[WRSH]
AFTER UPDATE
AS
BEGIN
SET NOCOUNT ON;
UPDATE wrsh
SET ModifiedDate = GETDATE()
FROM dbo.WRSH AS wrsh
INNER JOIN inserted AS i ON wrsh.Barcode = i.Barcode;
END;
Using a JOIN with the inserted pseudo-table improves performance by ensuring only the affected rows are updated.
For best results, ensure the Barcode column is indexed — preferably as a primary key or unique non-clustered index — to speed up the join operation in the trigger.
If you found this response helpful, please consider marking it as the accepted solution and giving it a thumbs-up to help others in the community.
Thank you & regards,
Prasanna Kumar