IF NOT EXISTS(SELECT ID FROM SYSOBJECTS WHERE NAME = 'EST_NF_ENT_NFE_CANCEL_ERR' AND XTYPE = 'U')
BEGIN
		CREATE TABLE [dbo].[EST_NF_ENT_NFE_CANCEL_ERR](
		 [CD_EMP] [int] NOT NULL,
		 [CD_FILIAL] [int] NOT NULL,
		 [CD_NF] [int] NOT NULL,
		 [CD_LOTE] [int] NOT NULL,
		 [NR_AUTORIZADOR] [varchar](44) NOT NULL,
		 [NR_PROTOCOLO] [varchar](100) NOT NULL,
		 [JUSTIFICATIVA] [varchar](600) NOT NULL,
		 [DS_RETORNO] [varchar](max) NOT NULL,
		 [DT_EVENTO] [datetime] NOT NULL,
		 [DT_CAD] [datetime] NOT NULL,
		 CONSTRAINT [PK_EST_NF_ENT_NFE_CANCEL_ERR] UNIQUE NONCLUSTERED 
		(
		 [CD_EMP] ASC,
		 [CD_FILIAL] ASC,
		 [CD_NF] ASC,
		 [CD_LOTE] ASC
		)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
		) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]

END


