IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[EST_PED_ELTR_FORN_CTR_ENV_ERROS_VALIDACAO]')) 
	begin
		return;
	end
else
begin

	
	CREATE TABLE [dbo].EST_PED_ELTR_FORN_CTR_ENV_ERROS_VALIDACAO(
		[CD_CTR_ERROS] [int] IDENTITY(1,1) NOT NULL,
		[CD_CTR_ENV] [int] NOT NULL CONSTRAINT [DF_EST_PED_ELTR_FORN_CTR_ENV_ERROS_VALIDACAO_CD_CTR_ENV]  DEFAULT ((0)),
		[DT_CAD] [datetime] NOT NULL,
		[ERROS_VALIDACAO] [xml] NOT NULL,
		[STS_ERRO] [int] NOT NULL CONSTRAINT [DF_EST_PED_ELTR_FORN_CTR_ENV_ERROS_VALIDACAO_STS_ERRO]  DEFAULT ((0)),
		[CD_USU] [int] NOT NULL CONSTRAINT [DF_EST_PED_ELTR_FORN_CTR_ENV_ERROS_VALIDACAO_CD_USU]  DEFAULT ((0)),
		[DT_CAD_CORRECAO] [datetime] NULL,
		[VERSAO_APLIC] [varchar](150) NULL,
	 CONSTRAINT [PK_EST_PED_ELTR_FORN_CTR_ENV_ERROS_VALIDACAO] PRIMARY KEY CLUSTERED 
	(
		[CD_CTR_ERROS] 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] TEXTIMAGE_ON [PRIMARY];

	

	ALTER TABLE [dbo].[EST_PED_ELTR_FORN_CTR_ENV_ERROS_VALIDACAO]  WITH CHECK ADD  CONSTRAINT [FK_EST_PED_ELTR_FORN_CTR_ENV_ERROS_VALIDACAO_EST_PED_ELTR_FORN_CTR_ENV] FOREIGN KEY([CD_CTR_ENV])
	REFERENCES [dbo].[EST_PED_ELTR_FORN_CTR_ENV] ([CD_CTR_ENV]);

	ALTER TABLE [dbo].[EST_PED_ELTR_FORN_CTR_ENV_ERROS_VALIDACAO] CHECK CONSTRAINT [FK_EST_PED_ELTR_FORN_CTR_ENV_ERROS_VALIDACAO_EST_PED_ELTR_FORN_CTR_ENV];



end

