IF OBJECT_ID('RC_CLI_CONV_PBM_CONTROLE_EST_PROD') IS NULL
begin
CREATE TABLE [dbo].[RC_CLI_CONV_PBM_CONTROLE_EST_PROD](
	[CD_EMP] [int] NOT NULL,
	[CD_FILIAL] [int] NOT NULL,
	[CD_PROD] [int] NOT NULL,
	[DT_CAD] [datetime] NOT NULL,
	[QT_SALDO] [money] NOT NULL,
 CONSTRAINT [PK_RC_CLI_CONV_PBM_CONTROLE_EST_PROD] PRIMARY KEY CLUSTERED 
(
	[CD_EMP] 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) ON [PRIMARY]
) ON [PRIMARY]

ALTER TABLE [dbo].[RC_CLI_CONV_PBM_CONTROLE_EST_PROD] ADD  CONSTRAINT [DF_RC_CLI_CONV_PBM_CONTROLE_EST_PROD_CD_EMP]  DEFAULT ((0)) FOR [CD_EMP]

ALTER TABLE [dbo].[RC_CLI_CONV_PBM_CONTROLE_EST_PROD] ADD  CONSTRAINT [DF_RC_CLI_CONV_PBM_CONTROLE_EST_PROD_CD_FILIAL]  DEFAULT ((0)) FOR [CD_FILIAL]

ALTER TABLE [dbo].[RC_CLI_CONV_PBM_CONTROLE_EST_PROD] ADD  CONSTRAINT [DF_RC_CLI_CONV_PBM_CONTROLE_EST_PROD_CD_PROD]  DEFAULT ((0)) FOR [CD_PROD]

ALTER TABLE [dbo].[RC_CLI_CONV_PBM_CONTROLE_EST_PROD] ADD  CONSTRAINT [DF_RC_CLI_CONV_PBM_CONTROLE_EST_PROD_DT_CAD]  DEFAULT (getdate()) FOR [DT_CAD]

ALTER TABLE [dbo].[RC_CLI_CONV_PBM_CONTROLE_EST_PROD] ADD  CONSTRAINT [DF_RC_CLI_CONV_PBM_CONTROLE_EST_PROD_QT_SALDO]  DEFAULT ((0)) FOR [QT_SALDO]
end