IF  NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[EST_PED_ELTR_DEMANDA_CP_IT]') AND type in (N'U'))
begin 

	/****** Object:  Table [dbo].[EST_PED_ELTR_DEMANDA_CP_IT]    Script Date: 08/26/2012 11:04:09 ******/
	SET ANSI_NULLS ON 
	SET QUOTED_IDENTIFIER ON
	 
	CREATE TABLE [dbo].[EST_PED_ELTR_DEMANDA_CP_IT](
		[CD_EMP] [int] NOT NULL,
		[CD_CTR_DEMANDA] [int] NOT NULL,
		[CD_FILIAL] [int] NOT NULL,
		[CD_PROD] [int] NOT NULL,
		[CD_COND_COMPRA] [int] NOT NULL,
		[QTDE_PROD] [money] NOT NULL,
		[VLR_PROD] [money] NOT NULL,
		[PERC_DESC] [money] NOT NULL,
		[CD_SIGLA] [INT] NULL,
		[MEDIAF] [money] NULL,
		[QT_EST] [money] NULL,
		[QT_EST_PEND] [money] NULL ,
		[QT_EST_MTZ] [money] NULL,
		[MAX_EMAX] 	[money] NULL, 
		[EMAX] [money] NULL,
		[ESEG] [money] NULL,
		[FACE] [money] NULL,
		[FINA] [money] NULL,
		[LIMITADOR] [money] NULL,
		
	 CONSTRAINT [PK_EST_PED_ELTR_DEMANDA_CP_IT] PRIMARY KEY CLUSTERED 
	(
		[CD_EMP] ASC,
		[CD_CTR_DEMANDA] ASC,
		[CD_FILIAL] ASC,
		[CD_PROD] 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]

	ALTER TABLE [dbo].[EST_PED_ELTR_DEMANDA_CP_IT]  WITH CHECK ADD  CONSTRAINT [FK_EST_PED_ELTR_DEMANDA_CP_IT_EST_PED_ELTR_DEMANDA_CP] FOREIGN KEY([CD_EMP], [CD_CTR_DEMANDA])
	REFERENCES [dbo].[EST_PED_ELTR_DEMANDA_CP] ([CD_EMP], [CD_CTR_DEMANDA])
	   
	ALTER TABLE [dbo].[EST_PED_ELTR_DEMANDA_CP_IT] CHECK CONSTRAINT [FK_EST_PED_ELTR_DEMANDA_CP_IT_EST_PED_ELTR_DEMANDA_CP]	 
	ALTER TABLE [dbo].[EST_PED_ELTR_DEMANDA_CP_IT] ADD  CONSTRAINT [DF_EST_PED_ELTR_DEMANDA_CP_IT_CD_EMP]  DEFAULT ((0)) FOR [CD_EMP]	  
	ALTER TABLE [dbo].[EST_PED_ELTR_DEMANDA_CP_IT] ADD  CONSTRAINT [DF_EST_PED_ELTR_DEMANDA_CP_IT_CD_CTR_DEMANDA]  DEFAULT ((0)) FOR [CD_CTR_DEMANDA]	  
	ALTER TABLE [dbo].[EST_PED_ELTR_DEMANDA_CP_IT] ADD  CONSTRAINT [DF_EST_PED_ELTR_DEMANDA_CP_IT_CD_FILIAL]  DEFAULT ((0)) FOR [CD_FILIAL]  
	ALTER TABLE [dbo].[EST_PED_ELTR_DEMANDA_CP_IT] ADD  CONSTRAINT [DF_EST_PED_ELTR_DEMANDA_CP_IT_CD_PROD]  DEFAULT ((0)) FOR [CD_PROD]	 
	ALTER TABLE [dbo].[EST_PED_ELTR_DEMANDA_CP_IT] ADD  CONSTRAINT [DF_EST_PED_ELTR_DEMANDA_CP_IT_CD_COND_COMPRA]  DEFAULT ((0)) FOR [CD_COND_COMPRA]	   
	ALTER TABLE [dbo].[EST_PED_ELTR_DEMANDA_CP_IT] ADD  CONSTRAINT [DF_EST_PED_ELTR_DEMANDA_CP_IT_QTDE_PROD]  DEFAULT ((0)) FOR [QTDE_PROD]
	ALTER TABLE [dbo].[EST_PED_ELTR_DEMANDA_CP_IT] ADD  CONSTRAINT [DF_EST_PED_ELTR_DEMANDA_CP_IT_VLR_PROD]  DEFAULT ((0)) FOR [VLR_PROD]	 
	ALTER TABLE [dbo].[EST_PED_ELTR_DEMANDA_CP_IT] ADD  CONSTRAINT [DF_EST_PED_ELTR_DEMANDA_CP_IT_PERC_DESC]  DEFAULT ((0)) FOR [PERC_DESC]	  
	ALTER TABLE [dbo].[EST_PED_ELTR_DEMANDA_CP_IT] ADD  CONSTRAINT [DF_EST_PED_ELTR_DEMANDA_CP_IT_CD_SIGLA]  DEFAULT ((0)) FOR [CD_SIGLA]	  
	ALTER TABLE [dbo].[EST_PED_ELTR_DEMANDA_CP_IT] ADD  CONSTRAINT [DF_EST_PED_ELTR_DEMANDA_CP_IT_MEDIAF]  DEFAULT ((0)) FOR [MEDIAF]	  
	ALTER TABLE [dbo].[EST_PED_ELTR_DEMANDA_CP_IT] ADD  CONSTRAINT [DF_EST_PED_ELTR_DEMANDA_CP_IT_QT_EST]  DEFAULT ((0)) FOR [QT_EST]		
	ALTER TABLE [dbo].[EST_PED_ELTR_DEMANDA_CP_IT] ADD  CONSTRAINT [DF_EST_PED_ELTR_DEMANDA_CP_IT_QT_EST_PEND]  DEFAULT ((0)) FOR [QT_EST_PEND]	   
	ALTER TABLE [dbo].[EST_PED_ELTR_DEMANDA_CP_IT] ADD  CONSTRAINT [DF_EST_PED_ELTR_DEMANDA_CP_IT_QT_EST_MTZ]  DEFAULT ((0)) FOR [QT_EST_MTZ]	   
	ALTER TABLE [dbo].[EST_PED_ELTR_DEMANDA_CP_IT] ADD  CONSTRAINT [DF_EST_PED_ELTR_DEMANDA_CP_IT_MAX_EMAX]  DEFAULT ((0)) FOR [MAX_EMAX]				
	ALTER TABLE [dbo].[EST_PED_ELTR_DEMANDA_CP_IT] ADD  CONSTRAINT [DF_EST_PED_ELTR_DEMANDA_CP_IT_EMAX]  DEFAULT ((0)) FOR [EMAX]	 
	ALTER TABLE [dbo].[EST_PED_ELTR_DEMANDA_CP_IT] ADD  CONSTRAINT [DF_EST_PED_ELTR_DEMANDA_CP_IT_ESEG]  DEFAULT ((0)) FOR [ESEG]	  
	ALTER TABLE [dbo].[EST_PED_ELTR_DEMANDA_CP_IT] ADD  CONSTRAINT [DF_EST_PED_ELTR_DEMANDA_CP_IT_FACE]  DEFAULT ((0)) FOR [FACE]	  
	ALTER TABLE [dbo].[EST_PED_ELTR_DEMANDA_CP_IT] ADD  CONSTRAINT [DF_EST_PED_ELTR_DEMANDA_CP_IT_FINA]  DEFAULT ((0)) FOR [FINA]	  
	ALTER TABLE [dbo].[EST_PED_ELTR_DEMANDA_CP_IT] ADD  CONSTRAINT [DF_EST_PED_ELTR_DEMANDA_CP_IT_LIMITADOR]  DEFAULT ((0)) FOR [LIMITADOR]
end 
 
  