AnsweredAssumed Answered

SQL Trigger in Versioned SDE

Question asked by ldcarto on Sep 16, 2014
Latest reply on Jun 28, 2018 by tpcolson

Hello,

 

I have been researching creating triggers in SQL to update the edit date and acreage values when an edit is completed on an SDE versioned feature class.  I have created the triggers and SQL says that the command is completed successfully, but when I make an edit to the feature class, those fields don't get updated.

I am using SQL Server 2008 R2 Management Studio Express and ArcGIS 10.2.1.  The feature class is versioned and I am only using the default version.  No other versions were created from that.  So, I don't need to reconcile any versions back to the default version.  The code I am using is below.

 

Use [DNR_SDE]

GO

SET ANSI_NULLS ON

GO

SET QUOTED_IDENTIFIER ON

GO

 

CREATE TRIGGER [DNR_Edit].[trg_insert_acres_date_fields]

     ON [DNR_Edit].[TRIBAL_TRUST_LANDS]

     AFTER INSERT, UPDATE

AS

BEGIN

     SET NOCOUNT ON;

 

     UPDATE [DNR_Edit].[TRIBAL_TRUST_LANDS]

          SET edit_date = getdate()

          WHERE OBJECTID IN (SELECT OBJECTID FROM INSERTED)

 

     UPDATE [DNR_EDIT].[TRIBAL_TRUST_LANDS]

          SET Acres = shape.STArea() * 0.000247105

          WHERE OBJECTID IN (SELECT OBJECTID FROM INSERTED)

 

END

 

Is there a potential delay with a versioned FC before the fields get populated?  I know others have used this same coding for an editable GIS web application and it is immediate, but I cannot figure out why it won't work for me.

 

Also, I would like to have a trigger that would automatically populate the latitude and longitude coordinates for any point added to a feature class or existing point adjusted.  Is there any way to do that?

 

Thanks in advance for any assistance.

 

Lisa

Outcomes