IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[EST_TRIB_ALIQ_MVA_NCM]')) 
	BEGIN 
		RETURN;
	END
ELSE
	BEGIN
		CREATE TABLE [dbo].[EST_TRIB_ALIQ_MVA_NCM](
			[CD_EMP] [int] NOT NULL,
			[CD_TBL_MVA] [int] NOT NULL,
			[NR_NCM] [varchar](50) NULL,
		 CONSTRAINT [IX_EST_TRIB_ALIQ_MVA_NCM] UNIQUE NONCLUSTERED 
		(
			[NR_NCM] ASC,
			[CD_TBL_MVA] ASC,
			[CD_EMP] ASC
		)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
		) ON [PRIMARY]



		SET ANSI_PADDING OFF
		

		ALTER TABLE [dbo].[EST_TRIB_ALIQ_MVA_NCM]  WITH CHECK ADD  CONSTRAINT [FK_EST_TRIB_ALIQ_MVA_NCM_EST_TRIB_ALIQ_MVA] FOREIGN KEY([CD_EMP], [CD_TBL_MVA])
		REFERENCES [dbo].[EST_TRIB_ALIQ_MVA] ([CD_EMP], [CD_TBL_MVA])
		ON UPDATE CASCADE
		ON DELETE CASCADE
		

		ALTER TABLE [dbo].[EST_TRIB_ALIQ_MVA_NCM] CHECK CONSTRAINT [FK_EST_TRIB_ALIQ_MVA_NCM_EST_TRIB_ALIQ_MVA]
		
	END


