Anyone familiar with triggers? I get a syntax error and im not sure what is wrong on line 2. First time creating a trigger.

CREATE TRIGGER trig_check_geometry
ON pipeline.tek_water_area AFTER INSERT, UPDATE
AS
BEGIN
IF EXISTS (
SELECT *
FROM inserted
WHERE geometry_column.STIsValid() = 0
)
BEGIN
RAISERROR ('Invalid geometry detected. Please insert valid geometries only.', 16, 1);
ROLLBACK TRANSACTION;
END
END
Follow

@Shlomo Is there a stray character on line 1 that you're missing? Your syntax looks okay according to SQL Server 2022.

learn.microsoft.com/en-us/sql/

· · Web · 1 · 0 · 0

@Shlomo If you're running straight SQL, you shouldn't. I don't know anything about pgadmin4.

Sign in to participate in the conversation
Merovingian Club

A club for red-pilled exiles.