USE [Database]

IF OBJECT_ID('[Tables].[trg_insert_product_types]', 'TR') IS NOT NULL
  DROP TRIGGER [Tables].[trg_insert_product_types];
GO
CREATE TRIGGER [Tables].[trg_insert_product_types] ON [Tables].[product_types] AFTER INSERT
  AS
  IF EXISTS(
    SELECT *
    FROM [inserted] AS [I]
    JOIN [Tables].[product_types] AS [PT]
      ON [PT].[id] = [I].[parent_id]
    JOIN [Tables].[products] AS [p]
      ON [p].[product_type_id] = [PT].[id]
     )
  BEGIN
    ROLLBACK TRANSACTION;
	RETURN;
  END
GO