There is a Enterprise geodatabase (MS SQL Server, ArcGIS), it has about 100 feature classes. It is necessary to automate the process of populating a unique number to each object in the database. numbers should not be repeated in all database. I created a SQL trigger that successfully filled the number. But base settings are without flag "move edits to base", and the trigger does not work, because it goes through the delta table. When the flag is true triggers work well. But I shouldn't use this flag. Any ideas how to do this without triggers?
CREATE TRIGGER DBO.UNIQ_id ON DBO.LAND_POL AFTER INSERT AS BEGIN SET NOCOUNT ON; DECLARE @MAXCOUNTLAST AS INT DECLARE @MAXCOUNTNEW AS INT SELECT @MAXCOUNTLAST=MAX(IDC_MAX.IDC) FROM DBO.IDC_MAX SELECT ONJECTID, IDC, ROW_NUMBER() OVER (ODER BY OBJECTID) AS aID INTO #T1 FROM INSERTED WHERE (IDC IS NULL); UPDATE #T1 SET aID = aID+@MAXCOUNTLAST UPDATE DBO.LAND_POL SET IDC=#T1.aID FROM DBO.LAND_POL A INNER JION #T1 ON A.OBJECTID=#T1.OBJECTID SELECT @MAXCOUNTNEW=MAX(LAND.POL.IDC) FROM DBO.LAND_POL UPDATE DBO.IDC_MAX SET IDC = @MAXCOUNTNEW END