CREATE PROCEDURE MIG_DOC_USERS_Sp
AS
BEGIN
	DELETE FROM MIG_DOC_USERS
	INSERT INTO MIG_DOC_USERS

	SELECT	ZZ_ID, 
			AUT.LN_USER as AUTHOR,  
			LCK.LN_USER as LOCKED_BY
	FROM DOC DOC
	LEFT JOIN MIG_USERS AUT	ON AUT.USER_NAME =  DOC.AUTHOR
	LEFT JOIN MIG_USERS LCK	ON LCK.USER_NAME = DOC.LOCKED_BY

END


