IF OBJECT_ID('EST_PROD_PRECIFICACAO_KIT_CPL') IS NULL 
	BEGIN 
	
		CREATE TABLE [dbo].[EST_PROD_PRECIFICACAO_KIT_CPL](
			[CD_EMP] [int] NOT NULL,
			[CD_PROD] [int] NOT NULL,
			[CD_PROD_IT] [int] NOT NULL,
			[QT_PROD] [money] NULL,
			[PERC_VLR_VENDA] [money] NULL,
		 CONSTRAINT [PK_EST_PROD_PRECIFICACAO_KIT_CPL] PRIMARY KEY CLUSTERED 
		(
			[CD_EMP] ASC,
			[CD_PROD] ASC,
			[CD_PROD_IT] ASC
		)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
		) ON [PRIMARY]

		 

		ALTER TABLE [dbo].[EST_PROD_PRECIFICACAO_KIT_CPL] ADD  CONSTRAINT [DF_EST_PROD_PRECIFICACAO_KIT_CPL_QT_PROD]  DEFAULT ((0)) FOR [QT_PROD]
		 

		ALTER TABLE [dbo].[EST_PROD_PRECIFICACAO_KIT_CPL] ADD  CONSTRAINT [DF_EST_PROD_PRECIFICACAO_KIT_CPL_PERC_VLR_VENDA]  DEFAULT ((0)) FOR [PERC_VLR_VENDA]
		 

		ALTER TABLE [dbo].[EST_PROD_PRECIFICACAO_KIT_CPL]  WITH CHECK ADD  CONSTRAINT [FK_EST_PROD_PRECIFICACAO_KIT_CPL_EST_PROD] FOREIGN KEY([CD_EMP], [CD_PROD_IT])
		REFERENCES [dbo].[EST_PROD] ([CD_EMP], [CD_PROD])
		 

		ALTER TABLE [dbo].[EST_PROD_PRECIFICACAO_KIT_CPL] CHECK CONSTRAINT [FK_EST_PROD_PRECIFICACAO_KIT_CPL_EST_PROD]
		 

		ALTER TABLE [dbo].[EST_PROD_PRECIFICACAO_KIT_CPL]  WITH CHECK ADD  CONSTRAINT [FK_EST_PROD_PRECIFICACAO_KIT_CPL_EST_PROD_PRECIFICACAO_KIT] FOREIGN KEY([CD_EMP], [CD_PROD])
		REFERENCES [dbo].[EST_PROD_PRECIFICACAO_KIT] ([CD_EMP], [CD_PROD])
		ON UPDATE CASCADE
		ON DELETE CASCADE
		 

		ALTER TABLE [dbo].[EST_PROD_PRECIFICACAO_KIT_CPL] CHECK CONSTRAINT [FK_EST_PROD_PRECIFICACAO_KIT_CPL_EST_PROD_PRECIFICACAO_KIT]
		 

	END
	