AnsweredAssumed Answered

SQL Trigger in non versioned feature class

Question asked by titalsm53 on Oct 10, 2017

Hello
We need to make a trigger that obtains the object id that is being updated in a non versioned feature class, this value is a parameter for a store produre.

The feature class is publish as a service because we need to collect data with the collector app for our leaks.

We took a trigger from the geonet community as a example but it shows an error when we update the record.

Thank you for the help!

Gaby

 


AFTER UPDATE
AS

declare @orderservi varchar (10)
declare @estatus integer

BEGIN

SET NOCOUNT ON;

UPDATE [SDE].[CEA_FUGASQROVCT]
SET FallaHoraI = getdate()
WHERE OBJECTID IN (SELECT OBJECTID FROM INSERTED)


UPDATE [SDE].[CEA_FUGASQROVCT]
SET FallaHoraF = getdate()
WHERE OBJECTID IN (SELECT OBJECTID FROM INSERTED)

SELECT TOP 1 @orderservi =OrdenServi from sde.CEA_FUGASQROVCT WHERE OBJECTID IN (SELECT OBJECTID FROM INSERTED)
SELECT TOP 1 @estatus = Estatus from sde.CEA_FUGASQROVCT WHERE OBJECTID IN (SELECT OBJECTID FROM INSERTED)

If @estatus = 502
exec dbo.cea_pr_fuga_gis @orderservi

END

GO

Outcomes