IF OBJECT_ID('EST_PED_ELTR_ATIVA_CP_HIST') IS NULL
	BEGIN 
		CREATE TABLE [dbo].[EST_PED_ELTR_ATIVA_CP_HIST](
			[CD_EMP] [int] NOT NULL,
			[CD_CTR] [int] NOT NULL,
			[CD_CTR_HIST] [int] NOT NULL,
			[DT_HR_EXEC] [datetime] NULL,
			[TP_ENV] [int] NOT NULL,
		 CONSTRAINT [PK_EST_PED_ELTR_ATIVA_CP_HIST] PRIMARY KEY CLUSTERED 
		(
			[CD_EMP] ASC,
			[CD_CTR] ASC,
			[CD_CTR_HIST] ASC
		)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON, FILLFACTOR = 90) ON [PRIMARY]
		) ON [PRIMARY]

		

		ALTER TABLE [dbo].[EST_PED_ELTR_ATIVA_CP_HIST]  WITH CHECK ADD  CONSTRAINT [FK_EST_PED_ELTR_ATIVA_CP_HIST_EST_PED_ELTR_ATIVA_CP] FOREIGN KEY([CD_EMP], [CD_CTR])
		REFERENCES [dbo].[EST_PED_ELTR_ATIVA_CP] ([CD_EMP], [CD_CTR])
		ON UPDATE CASCADE
		ON DELETE CASCADE
		

		ALTER TABLE [dbo].[EST_PED_ELTR_ATIVA_CP_HIST] CHECK CONSTRAINT [FK_EST_PED_ELTR_ATIVA_CP_HIST_EST_PED_ELTR_ATIVA_CP]
		

	END