
IF OBJECT_ID(N'dbo.MIG_EO_CHEKIN_STP_PARAMS', N'U') IS NULL
	BEGIN	
		CREATE TABLE [dbo].[MIG_EO_CHEKIN_STP_PARAMS](
			[EO_ID] [varchar](30) NOT NULL,
			[ROUTE_ID] [varchar](30) NOT NULL,
			[STEP_ID] [varchar](15) NOT NULL,
			[PRM_VALUE] [varchar](255) NOT NULL,
		 CONSTRAINT PK_MIG_EO_CHEKIN_STP_PARAMS PRIMARY KEY (EO_ID, ROUTE_ID, STEP_ID)
		) ON [PRIMARY]
	END
GO

-- insert data to table

INSERT INTO [MIG_EO_CHEKIN_STP_PARAMS]

	select  TP.EO_ID,
			TP.ROUTE_ID,
			TP.STEP_ID,
			TP.PRM_VALUE
	from	EO_RT_TOOL_PRM TP
	LEFT JOIN NINTRA_TOOL NT
		ON TP.TOOL_KEY = NT.TOOL_KEY 
		AND TP.PRM_IDX = NT.PRM_IDX
	WHERE  NT.TOOL_KEY= 'WkFl_CheckIn' 
		AND TP.PRM_IDX = '1' 
	Order By TP.EO_ID





