CREATE OR ALTER PROCEDURE MIG_ANZ_EO_RT_SYSTEM_COMMANDS_Sp
AS BEGIN 

	SELECT DISTINCT ROUTE_ID, STEP_ID, SYSTEM_CMD_TEXT 
	FROM
	(
		SELECT DISTINCT ROUTE_ID, STEP_ID, SYSTEM_CMD_TEXT FROM RT_SYS_STP
		UNION
		SELECT DISTINCT ROUTE_ID, STEP_ID, SYSTEM_CMD_TEXT FROM EO_RT_SYST_STP
	) T
	ORDER BY T.ROUTE_ID, T.STEP_ID

END

-- exec MIG_ANZ_EO_RT_SYSTEM_COMMANDS_Sp

--INSERT INTO RT_SYS_STP(DB_ZZ_ID, ROUTE_ID, STEP_ID, SYSTEM_CMD_TEXT, SKIP_STEP, UPDATED_ON)
--VALUES
--(1, 'T1', 'S1', 'C:\Test\TestForm1.exe', 0, SYSUTCDATETIME()),
--(1, 'T1', 'S2', 'C:\Test\TestForm2.exe', 0, SYSUTCDATETIME()),
--(1, 'T1', 'S3', 'C:\Test\TestForm3.exe', 0, SYSUTCDATETIME()),
--(1, 'T2', 'S5', 'C:\Test\TestForm5.exe', 0, SYSUTCDATETIME())

--INSERT INTO EO_RT_SYST_STP(DB_ZZ_ID, EO_ID, ROUTE_ID, STEP_ID, SYSTEM_CMD_TEXT, SKIP_STEP, UPDATED_ON)
--VALUES
--(1, 'E1', 'T1', 'S2', 'C:\Test\TestForm2.exe', 0, SYSUTCDATETIME()),
--(1, 'E2', 'T1', 'S3', 'C:\Test\TestForm33.exe', 0, SYSUTCDATETIME()),
--(1, 'E3', 'T2', 'S6', 'C:\Test\TestForm6.exe', 0, SYSUTCDATETIME())

