SQL Trigger on Insert in ArcSDE Not Showing

1164
0
03-06-2017 09:07 AM
MeleKoneya
Occasional Contributor III

I have created a Trigger in SQL to update a field called asset_id.    

It does work, but I can't see the value until after I save the edit in ArcMap and stop editing.     I am also wanting to see the new asset_id value in ArcGIS WebAppbuilder,  but I don't see it until after I exit the app and reopen it.

The Feature Class is versioned as in ArcSDE 10.2.2 on SQL Server 2014.

I do not have the 'Save Edits to Base' option checked.

Why am I not able to see the edits as soon as they are made on an Insert?

CREATE TRIGGER [sde].[trg_insert_asset_id]

ON [sde].[a98]

AFTER INSERT

AS

BEGIN

-- SET NOCOUNT ON added to prevent extra result sets from

-- interfering with SELECT statements.

SET NOCOUNT ON;

-- Insert statements for trigger here

DECLARE @id int

--PRINT @ReturnValue

UPDATE [dbo].[Sequences]

SET next_id = next_id + 1

WHERE sequenceName = 'ASSETID'

SET @id = (SELECT next_id

FROM [dbo].[Sequences]

WHERE sequenceName = 'ASSETID')

UPDATE s

SET Asset_ID = @id

FROM preserve.sde.a98 s, inserted

WHERE s.OBJECTID = inserted.OBJECTID

END

0 Kudos
0 Replies