IF EXISTS (SELECT * FROM sys.triggers WHERE object_id = OBJECT_ID(N'dbo.TRIGGER_RateLevelRoomTypeXTabHistAfterInsert'))
DROP TRIGGER dbo.TRIGGER_RateLevelRoomTypeXTabHistAfterInsert
GO

CREATE TRIGGER dbo.TRIGGER_RateLevelRoomTypeXTabHistAfterInsert ON RateLevelRoomTypeXTab AFTER INSERT, UPDATE AS
/*
  Created by Kent Johansen, december 2021
*/

BEGIN
  SET NOCOUNT ON;
  INSERT INTO RateLevelRoomTypeXTab_Hist
  SELECT ID, FKRateLevelId, FKRoomTypeNumber, GETDATE()
  FROM inserted
END