CREATE PROCEDURE MIG_DOC_TYPE_OPTIONS_Sp
AS
BEGIN

	DELETE FROM MIG_DOC_TYPE_OPTIONS

	INSERT INTO MIG_DOC_TYPE_OPTIONS
	SELECT	PROJ.PROJECT_ID, 
			LN_DOC_TYPE AS DOC_TYPE, 
			PREF_VALUE
	FROM PROJ_CONFIG PROJ
	INNER JOIN MIG_DOC_TYPE DT
		 ON PROJ.CLASS_ID = DT.SHORT_DESCR
	WHERE PREF_NAME = 'RELATED_FILE'
	AND CLASS_ID NOT IN ('*', 'DOC')

END

