简体   繁体   中英

.NET SQL Server Update Trigger

I'm updating a SQL Server table (say table1) through .NET Entity Framework. table1 has got an update trigger defined which updates data on table2. Then upon save changes, an SSRS report gets generated which uses updated data from table2.

All this looks good and works fine.

But, once in a while in deployed application, I see that the generated report gets table2 values those were before trigger execution.

So far it's my understanding that triggers are synchronous, hence couldn't comprehend the reason behind this timing issue. Also appreciate if you have any remedy suggestions.

Using .NET Framework 4.6, SQL Server 2014

I believe the trigger fires off before the update by default. to make it fire after you have to define the trigger with the property CREATE TRIGGER AFTER ACTION.

You could also make the proc that does does the update generate the SSRS report after the update instead of using a trigger.

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM