Quantcast
Channel: ฟอรัม Getting started with SQL Server
Viewing all articles
Browse latest Browse all 8428

Insert Trigger causes application to think "another user modified data during the operation"

$
0
0

We are using an application called Sage FAS (Premier Depreciation).

They have an Asset table "currently with no triggers" where we need to update a table in another SQL Server when receives a new entry.

So we added the following insert trigger:

USE [Sage_FAS] GO /****** Object: Trigger [dbo].[tAsseti] Script Date: 11/25/2013 10:04:17 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO ALTER TRIGGER [dbo].[tAsseti] on [dbo].[Asset] FOR INSERT AS BEGIN SET NOCOUNT ON; UPDATE U SET U.AddedToSage = 'Y' FROM inserted I INNER JOIN [TBGVP-01].[Viewpoint].[dbo].[budSageDepreciation] AS U ON I.User10 = U.Co

AND I.CompAsstNo COLLATE SQL_Latin1_General_CP1_CI_AS = U.Equipment WHERE U.AddedToSage = 'N' END

As you can see it is a very simple flag update in another sql server.

Now we were first getting errors about not being able to begin a distributed transaction.  We fixed this by adding the role Application Server and selecting the distributed transaction features.  

So at the raw table level I could add a new record and I see the corresponding entry in the other server updating properly.

BUT... if I add the new record via the Sage FAS application it throws an error stating"Save did not execute because another user modified data during the operation.  Your changes were NOT saved"

So outside of the application it works when adding record directly to table, but from within the application it does not like it.  Of course outside of the application I am not specifically beginning a transaction like the application does.

So my question... is there a way I can alter this trigger or something to prevent the application from thinking something has changed data during the operation???  I am wondering if the distributed transaction being fired off is confusing the application. Or do I need to add some sort of code to the trigger.

Thanks for  your time!


Viewing all articles
Browse latest Browse all 8428

Trending Articles