CREATE PROCEDURE [MIG_CREATE_ENTRIES_IN_MAPPING_RULES_PDM_OBJS_Sp]
AS BEGIN
	-- The purpose of this stored procedure is to create the data for table [MIG_MAPPING_RULES_PDM_OBJS] table.

	-- cfeMappingTool.xml

	DELETE FROM MIG_MAPPING_RULES_PDM_OBJS

	INSERT INTO MIG_MAPPING_RULES_PDM_OBJS(MAPPING_RULES_PDM_OBJ_ID, MAPPING_RULES_PDM_FLD_OBJ_ID, SOURCE_OBJ_TITLE, SOURCE_LINK_TITLE, TARGET_TABLE) 
	VALUES
		('ITEM',				'ITEM',						'ITEM',					'',		'pdpdm100'),
		('DOC',					'DOC',						'DOC',					'',		'pdpdm200'),
		('FILE',				'FILE.FILE_NAME',			'FILE',					'',		'pdpdm500'),
		('PROJECT',				'PROJECT',					'PROJECT',				'',		'pdadm300'),
		('EO',					'ITEM.EO',					'EO',					'',		'pdwfl100'),
		('EO_HISTORY',			'ITEM.EO_HISTORY',			'EO_HISTORY',			'',		'pdwfl104'),
		('EO_HISTORY',			'DOC.EO_HISTORY',			'EO_HISTORY',			'',		'pdwfl104'),
		('ITEM_VAULT_HISTORY',	'ITEM.ITEM_VAULT_HISTORY',	'ITEM_VAULT_HISTORY',	'',		'pdpdm117'),
		('DOC_VAULT_HISTORY',	'DOC.DOC_VAULT_HISTORY',	'DOC_VAULT_HISTORY',	'',		'pdpdm208'),
		('CUSTOMER',			'ITEM.CUSTOMER',			'CUSTOMER',				'',		'tccom100'),  -- pdpdm103
		('MANUFACTURERS',		'ITEM.MANUFACTURERS',		'MANUFACTURERS',		'',		'tcmcs060'),  -- pdpdm108
		('SUPPLIER',			'ITEM.SUPPLIER',			'SUPPLIER',				'',		'tccom100'),  -- pdpdm120
		('SUB_CONTRACTOR',		'ITEM.SUB_CONTRACTOR',		'SUB_CONTRACTOR',		'',		'tccom100')   -- pdpdm112
END

-- exec MIG_CREATE_ENTRIES_IN_MAPPING_RULES_PDM_OBJS_Sp
-- SELECT * FROM MIG_MAPPING_RULES_PDM_OBJS

--SELECT * FROM OBJ_DEF_ATTR WHERE OBJ_TITLE = 'FILE' AND LINK_TITLE = ''

--SELECT DISTINCT OBJ_TITLE, LINK_TITLE FROM OBJ_DEF_ATTR ORDER BY OBJ_TITLE, LINK_TITLE

--SELECT * FROM OBJECT_DEF WHERE TABLE_NAME = 'CHECK_ITEM'
