IF NOT EXISTS (SELECT * FROM SYS.TABLES WHERE NAME = 'RC_CLI_ESTATIS_EST_PROD')
Begin
CREATE TABLE [dbo].[RC_CLI_ESTATIS_EST_PROD](
	[CD_EMP] [int] NOT NULL,
	[CD_FILIAL] [int] NOT NULL,
	[CD_CLI] [int] NOT NULL,
	[CD_PROD] [int] NOT NULL,
	[QT_IT] [money] NOT NULL,
	[VLR_VD] [money] NOT NULL,
 CONSTRAINT [PK_RC_CLI_ESTATIS_EST_PROD] PRIMARY KEY CLUSTERED 
(
	[CD_EMP] ASC,
	[CD_FILIAL] ASC,
	[CD_CLI] ASC,
	[CD_PROD] 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].[RC_CLI_ESTATIS_EST_PROD] ADD  CONSTRAINT [DF_RC_CLI_ESTATIS_EST_PROD_CD_EMP]  DEFAULT ((0)) FOR [CD_EMP]

ALTER TABLE [dbo].[RC_CLI_ESTATIS_EST_PROD] ADD  CONSTRAINT [DF_RC_CLI_ESTATIS_EST_PROD_CD_FILIAL]  DEFAULT ((0)) FOR [CD_FILIAL]

ALTER TABLE [dbo].[RC_CLI_ESTATIS_EST_PROD] ADD  CONSTRAINT [DF_RC_CLI_ESTATIS_EST_PROD_CD_CLI]  DEFAULT ((0)) FOR [CD_CLI]

ALTER TABLE [dbo].[RC_CLI_ESTATIS_EST_PROD] ADD  CONSTRAINT [DF_RC_CLI_ESTATIS_EST_PROD_CD_PROD]  DEFAULT ((0)) FOR [CD_PROD]

ALTER TABLE [dbo].[RC_CLI_ESTATIS_EST_PROD] ADD  CONSTRAINT [DF_RC_CLI_ESTATIS_EST_PROD_QT_IT]  DEFAULT ((0)) FOR [QT_IT]

ALTER TABLE [dbo].[RC_CLI_ESTATIS_EST_PROD] ADD  CONSTRAINT [DF_RC_CLI_ESTATIS_EST_PROD_VLR_VD]  DEFAULT ((0)) FOR [VLR_VD]

end