
  --add new default system parameter
	DECLARE @SystemParameters TABLE 
		(
			[InstanceName] [nvarchar](50) NOT NULL,
			[InstanceIdentifier] [nvarchar](50) NOT NULL,
			[ParameterKey] [nvarchar](100) NOT NULL,
			[ParameterDesc] [nvarchar](500) NOT NULL,
			[Value] [nvarchar](max) NOT NULL,
			[DataType] [nvarchar](20) NOT NULL,
			[AllowDelete] [bit] NOT NULL
		);

	


	INSERT @SystemParameters ([InstanceName],[InstanceIdentifier],[ParameterKey],[ParameterDesc],[Value],[DataType],[AllowDelete]) 	
	VALUES ('AdlRulePolicyPro', 'default', 'MaximumNumberOfRules', 'Maximum Number Of Rules Allowed.', '128', 'System.Int', 0)

	INSERT @SystemParameters ([InstanceName],[InstanceIdentifier],[ParameterKey],[ParameterDesc],[Value],[DataType],[AllowDelete]) 	
	VALUES ('AdlRulePolicyPro', 'default', 'MaximumNumberOfPeriods', 'Maximum Number Of Periods Allowed', '16', 'System.Int', 0)


	INSERT @SystemParameters ([InstanceName],[InstanceIdentifier],[ParameterKey],[ParameterDesc],[Value],[DataType],[AllowDelete]) 	
	VALUES ('AdlRulePolicyPro', 'default', 'Presence_Maximum', 'Maximum number of rules of type Presence allowed', '1', 'System.Int', 0)

	INSERT @SystemParameters ([InstanceName],[InstanceIdentifier],[ParameterKey],[ParameterDesc],[Value],[DataType],[AllowDelete]) 	
	VALUES ('AdlRulePolicyPro', 'default', 'UnexpectedEntryExit_Maximum', 'Maximum number of rules of type UnexpectedEntryExit allowed', '1', 'System.Int', 0)

	INSERT @SystemParameters ([InstanceName],[InstanceIdentifier],[ParameterKey],[ParameterDesc],[Value],[DataType],[AllowDelete]) 	
	VALUES ('AdlRulePolicyPro', 'default', 'Wandering_Maximum', 'Maximum number of rules of type ExtremeLowActivity allowed', '0', 'System.Int', 0)

	INSERT @SystemParameters ([InstanceName],[InstanceIdentifier],[ParameterKey],[ParameterDesc],[Value],[DataType],[AllowDelete]) 	
	VALUES ('AdlRulePolicyPro', 'default', 'OutOfHome_Maximum', 'Maximum number of rules of type OutOfHome allowed', '0', 'System.Int', 0)


	INSERT @SystemParameters ([InstanceName],[InstanceIdentifier],[ParameterKey],[ParameterDesc],[Value],[DataType],[AllowDelete]) 	
	VALUES ('AdlRulePolicyPro', 'default', 'ExcessiveNumOfDetection_Maximums', 'Maximum number of rules of type ExcessiveNumOfDetections allowed', '0', 'System.Int', 0)

	INSERT @SystemParameters ([InstanceName],[InstanceIdentifier],[ParameterKey],[ParameterDesc],[Value],[DataType],[AllowDelete]) 	
	VALUES ('AdlRulePolicyPro', 'default', 'UnexpectedPresence_Maximum', 'Maximum number of rules of type UnexpectedPresence allowed', '0', 'System.Int', 0)

	INSERT @SystemParameters ([InstanceName],[InstanceIdentifier],[ParameterKey],[ParameterDesc],[Value],[DataType],[AllowDelete]) 	
	VALUES ('AdlRulePolicyPro', 'default', 'HighNumOfVisits_Maximum', 'Maximum number of rules of type HighNumOfVisits allowed.', '0', 'System.Int', 0)

	INSERT @SystemParameters ([InstanceName],[InstanceIdentifier],[ParameterKey],[ParameterDesc],[Value],[DataType],[AllowDelete]) 	
	VALUES ('AdlRulePolicyPro', 'default', 'LongStay_Maximum', 'Maximum number of rules of type LongStay allowed', '0', 'System.Int', 0)

	INSERT @SystemParameters ([InstanceName],[InstanceIdentifier],[ParameterKey],[ParameterDesc],[Value],[DataType],[AllowDelete]) 	
	VALUES ('AdlRulePolicyPro', 'default', 'ShortStay_Maximum', 'Maximum number of rules of type ShortStay allowed', '0', 'System.Int', 0)

	INSERT @SystemParameters ([InstanceName],[InstanceIdentifier],[ParameterKey],[ParameterDesc],[Value],[DataType],[AllowDelete]) 	
	VALUES ('AdlRulePolicyPro', 'default', 'ShortStayBedroom_Maximum', 'Maximum number of rules of type ShortStayBedroom allowed', '0', 'System.Int', 0)

	INSERT @SystemParameters ([InstanceName],[InstanceIdentifier],[ParameterKey],[ParameterDesc],[Value],[DataType],[AllowDelete]) 	
	VALUES ('AdlRulePolicyPro', 'default', 'LowNumOfVisits_Maximum', 'Maximum number of rules of type LowNumOfVisits allowed', '0', 'System.Int', 0)

	INSERT @SystemParameters ([InstanceName],[InstanceIdentifier],[ParameterKey],[ParameterDesc],[Value],[DataType],[AllowDelete]) 	
	VALUES ('AdlRulePolicyPro', 'default', 'LowNumOfDetections_Maximum', 'Maximum number of rules of type LowNumOfDetections allowed', '0', 'System.Int', 0)

	INSERT @SystemParameters ([InstanceName],[InstanceIdentifier],[ParameterKey],[ParameterDesc],[Value],[DataType],[AllowDelete]) 	
	VALUES ('AdlRulePolicyPro', 'default', 'NoActivityDetected_Maximum', 'Maximum number of rules of type NoActivityDetected allowed', '0', 'System.Int', 0)

	INSERT @SystemParameters ([InstanceName],[InstanceIdentifier],[ParameterKey],[ParameterDesc],[Value],[DataType],[AllowDelete]) 	
	VALUES ('AdlRulePolicyPro', 'default', 'Absent_Maximum', 'Maximum number of rules of type Absent allowed', '0', 'System.Int', 0)
	INSERT @SystemParameters ([InstanceName],[InstanceIdentifier],[ParameterKey],[ParameterDesc],[Value],[DataType],[AllowDelete]) 	
	VALUES ('AdlRulePolicyPro', 'default', 'Inactivity_Maximum', 'Maximum number of rules of type Inactivity allowed', '0', 'System.Int', 0)


	INSERT @SystemParameters ([InstanceName],[InstanceIdentifier],[ParameterKey],[ParameterDesc],[Value],[DataType],[AllowDelete]) 	
	VALUES ('AdlRulePolicyPro', 'default', 'MaximumNumberOfRules_Manual', 'Maximum number of rules definition type User Defined', '20', 'System.Int', 0)

    INSERT @SystemParameters ([InstanceName],[InstanceIdentifier],[ParameterKey],[ParameterDesc],[Value],[DataType],[AllowDelete]) 	
	VALUES ('AdlRulePolicyPro', 'default', 'MaximumNumberOfPeriods_Manual', 'Maximum number of rules definition type User Defined', '8', 'System.Int', 0)


	MERGE INTO [dbo].[SystemParameters] AS TARGET
	USING @SystemParameters AS SOURCE
	ON		SOURCE.InstanceName = TARGET.InstanceName AND 
			SOURCE.InstanceIdentifier = TARGET.InstanceIdentifier AND 
			SOURCE.ParameterKey = TARGET.ParameterKey
	WHEN NOT MATCHED BY TARGET THEN
		INSERT (InstanceName,InstanceIdentifier,ParameterKey,ParameterDesc,Value,DataType,AllowDelete)
		VALUES (SOURCE.InstanceName,SOURCE.InstanceIdentifier,SOURCE.ParameterKey,SOURCE.ParameterDesc,SOURCE.Value,SOURCE.DataType,SOURCE.AllowDelete);
	