IF OBJECT_ID('EST_PED_ELTR_FORN_CTR_ENV_PG_FORN_INTEGRACAO_ARQ_PENDENTE') IS NULL
	BEGIN 

		CREATE TABLE [dbo].[EST_PED_ELTR_FORN_CTR_ENV_PG_FORN_INTEGRACAO_ARQ_PENDENTE](
			[CD_CTR_ENV] [int] NOT NULL,
			[CD_CTR] [int] NOT NULL,
			[ARQ_XML_PEDIDO] [varchar](255) NULL,
			[ARQ_XML_PROC] [int] NULL,
			[DT_HT_ARQ_XML_PROC] [datetime] NULL,
		 CONSTRAINT [PK_EST_PED_ELTR_FORN_CTR_ENV_PG_FORN_INTEGRACAO_ARQ_PENDENTE] PRIMARY KEY CLUSTERED 
		(
			[CD_CTR_ENV] ASC,
			[CD_CTR] 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_FORN_CTR_ENV_PG_FORN_INTEGRACAO_ARQ_PENDENTE]  WITH CHECK ADD  CONSTRAINT [FK_EST_PED_ELTR_FORN_CTR_ENV_PG_FORN_INTEGRACAO_ARQ_PENDENTE_EST_PED_ELTR_FORN_CTR_ENV] FOREIGN KEY([CD_CTR_ENV])
		REFERENCES [dbo].[EST_PED_ELTR_FORN_CTR_ENV] ([CD_CTR_ENV])
		ON UPDATE CASCADE
		ON DELETE CASCADE
		

		ALTER TABLE [dbo].[EST_PED_ELTR_FORN_CTR_ENV_PG_FORN_INTEGRACAO_ARQ_PENDENTE] CHECK CONSTRAINT [FK_EST_PED_ELTR_FORN_CTR_ENV_PG_FORN_INTEGRACAO_ARQ_PENDENTE_EST_PED_ELTR_FORN_CTR_ENV]
		

		ALTER TABLE [dbo].[EST_PED_ELTR_FORN_CTR_ENV_PG_FORN_INTEGRACAO_ARQ_PENDENTE]  WITH CHECK ADD  CONSTRAINT [FK_EST_PED_ELTR_FORN_CTR_ENV_PG_FORN_INTEGRACAO_ARQ_PENDENTE_PG_FORN_INTEGRACAO_ARQ_PENDENTE] FOREIGN KEY([CD_CTR])
		REFERENCES [dbo].[PG_FORN_INTEGRACAO_ARQ_PENDENTE] ([CD_CTR])
		

		ALTER TABLE [dbo].[EST_PED_ELTR_FORN_CTR_ENV_PG_FORN_INTEGRACAO_ARQ_PENDENTE] CHECK CONSTRAINT [FK_EST_PED_ELTR_FORN_CTR_ENV_PG_FORN_INTEGRACAO_ARQ_PENDENTE_PG_FORN_INTEGRACAO_ARQ_PENDENTE]
		

		ALTER TABLE [dbo].[EST_PED_ELTR_FORN_CTR_ENV_PG_FORN_INTEGRACAO_ARQ_PENDENTE] ADD  CONSTRAINT [DF_EST_PED_ELTR_FORN_CTR_ENV_PG_FORN_INTEGRACAO_ARQ_PENDENTE_ARQ_XML_PEDIDO]  DEFAULT ('') FOR [ARQ_XML_PEDIDO]
		

		ALTER TABLE [dbo].[EST_PED_ELTR_FORN_CTR_ENV_PG_FORN_INTEGRACAO_ARQ_PENDENTE] ADD  CONSTRAINT [DF_EST_PED_ELTR_FORN_CTR_ENV_PG_FORN_INTEGRACAO_ARQ_PENDENTE_ARQ_XML_PROC]  DEFAULT ((0)) FOR [ARQ_XML_PROC]
		

	END
