------------------------------------------------------------------------------
-- ADVANTAGE 2004.3.7
-- TRIGGERS SINCE ADVANTAGE 2004.3.6 - TRIGGERS MUST be FIRST item in a script
-- 30 NOV 2007
------------------------------------------------------------------------------


-- USE Advantage
-- GO




-------------------------------------------------------------------------------
-- NEW TRIGGERS
-------------------------------------------------------------------------------


if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[Ins_Lup_AC_Markup_Categories_ID]') and OBJECTPROPERTY(id, N'IsTrigger') = 1)
drop trigger [dbo].[Ins_Lup_AC_Markup_Categories_ID]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[Ins_Lup_AP_Markup_Groups_ID]') and OBJECTPROPERTY(id, N'IsTrigger') = 1)
drop trigger [dbo].[Ins_Lup_AP_Markup_Groups_ID]
GO


-------------------------------------------------------------------------------
--Description   : Ins_Lup_AC_Markup_Categories_ID
--Purpose       : Cartesian Product Insert
--              : for a newly added Lup_AC_Markup_Categories record into
--              : AS_Markup_Categories_Groups
--Functionality : Tables: Lup_AP_Markup_Groups_ID, Lup_AC_Markup_Categories_ID
--Parameters    : 
--Date          : 2007/07/23
--Authors       : TB
--Version       : 1.0.0
-------------------------------------------------------------------------------


CREATE TRIGGER  Ins_Lup_AC_Markup_Categories_ID 
    ON dbo.Lup_AC_Markup_Categories

FOR INSERT

AS

SET NOCOUNT ON

	INSERT AS_Markup_Categories_Groups
        (
            Lup_AC_Markup_Categories_ID,
            Lup_AP_Markup_Groups_ID
        )
    SELECT i.Lup_AC_Markup_Categories_ID,
           pg.Lup_AP_Markup_Groups_ID
    FROM Inserted i
        CROSS JOIN Lup_AP_Markup_Groups pg


SET NOCOUNT OFF






GO
SET QUOTED_IDENTIFIER OFF 
GO
SET ANSI_NULLS ON 
GO

SET QUOTED_IDENTIFIER ON 
GO
SET ANSI_NULLS ON 
GO




-------------------------------------------------------------------------------
--Description   : Ins_Lup_AP_Markup_Groups_ID
--Purpose       : Cartesian Product Insert
--              : for a newly added Lup_AC_Markup_Categories record into
--              : AS_Markup_Categories_Groups
--Functionality : Tables: Lup_AP_Markup_Groups_ID, Lup_AC_Markup_Categories_ID
--Parameters    : 
--Date          : 2007/07/23
--Authors       : TB
--Version       : 1.0.0
-------------------------------------------------------------------------------

CREATE TRIGGER  Ins_Lup_AP_Markup_Groups_ID
    ON Lup_AP_Markup_Groups

FOR INSERT

AS

SET NOCOUNT ON

	INSERT AS_Markup_Categories_Groups
        (
            Lup_AP_Markup_Groups_ID,
            Lup_AC_Markup_Categories_ID
        )
    SELECT i.Lup_AP_Markup_Groups_ID,
           dc.Lup_AC_Markup_Categories_ID
    FROM Inserted i
        CROSS JOIN Lup_AC_Markup_Categories dc

SET NOCOUNT OFF






GO
SET QUOTED_IDENTIFIER OFF 
GO
SET ANSI_NULLS ON 
GO


-------------------------------------------------------------------------------