 
IF NOT EXISTS(SELECT * FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME='EST_NF_ENT_DANFE_PROVISORIO_ITENS_VALIDACAO_NATUREZA_DANFE')
 
BEGIN
 
CREATE TABLE [dbo].[EST_NF_ENT_DANFE_PROVISORIO_ITENS_VALIDACAO_NATUREZA_DANFE](
	[CD_EMP] [int] NOT NULL,
	[CD_MOV_OP] [int] NOT NULL,
	[DT_CAD] [datetime] NULL,
	[CD_USU] [int] NULL,
 CONSTRAINT [PK_EST_NF_ENT_DANFE_PROVISORIO_ITENS_VALIDACAO_NATUREZA_DANFE] PRIMARY KEY CLUSTERED 
(
	[CD_EMP] ASC,
	[CD_MOV_OP] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]


ALTER TABLE [dbo].[EST_NF_ENT_DANFE_PROVISORIO_ITENS_VALIDACAO_NATUREZA_DANFE]  WITH CHECK ADD  CONSTRAINT [FK_EST_NF_ENT_DANFE_PROVISORIO_ITENS_VALIDACAO_NATUREZA_DANFE_CD_MOV_OP] FOREIGN KEY([CD_MOV_OP])
REFERENCES [dbo].[GLB_MOV_OP] ([CD_MOV_OP])


ALTER TABLE [dbo].[EST_NF_ENT_DANFE_PROVISORIO_ITENS_VALIDACAO_NATUREZA_DANFE] CHECK CONSTRAINT [FK_EST_NF_ENT_DANFE_PROVISORIO_ITENS_VALIDACAO_NATUREZA_DANFE_CD_MOV_OP]

 
END;

