IF  NOT EXISTS (SELECT * FROM sys.objects 
					WHERE object_id = OBJECT_ID(N'[dbo].[RC_CLI_CONV_PBM_EST_PROD_TBL_DESC]') 
					AND type in (N'U')) 
begin
CREATE TABLE [dbo].[RC_CLI_CONV_PBM_EST_PROD_TBL_DESC](
	[CD_EMP] [int] NOT NULL,
	[CD_CONV] [int] NOT NULL,
	[CD_TBL_DESC] [int] NOT NULL,
	[CD_USU] [int] NOT NULL,
	[DT_CAD] [datetime] NULL,
 CONSTRAINT [PK_RC_CLI_CONV_PBM_EST_PROD_TBL_DESC] PRIMARY KEY CLUSTERED 
(
	[CD_EMP] ASC,
	[CD_CONV] ASC,
	[CD_TBL_DESC] 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_EST_PROD_TBL_DESC] ADD  CONSTRAINT [DF_RC_CLI_CONV_PBM_EST_PROD_TBL_DESC_CD_EMP]  DEFAULT ((0)) FOR [CD_EMP]

ALTER TABLE [dbo].[RC_CLI_CONV_PBM_EST_PROD_TBL_DESC] ADD  CONSTRAINT [DF_RC_CLI_CONV_PBM_EST_PROD_TBL_DESC_CD_CONV]  DEFAULT ((0)) FOR [CD_CONV]

ALTER TABLE [dbo].[RC_CLI_CONV_PBM_EST_PROD_TBL_DESC] ADD  CONSTRAINT [DF_RC_CLI_CONV_PBM_EST_PROD_TBL_DESC_CD_TBL_DESC]  DEFAULT ((0)) FOR [CD_TBL_DESC]

ALTER TABLE [dbo].[RC_CLI_CONV_PBM_EST_PROD_TBL_DESC] ADD  CONSTRAINT [DF_RC_CLI_CONV_PBM_EST_PROD_TBL_DESC_CD_USU]  DEFAULT ((0)) FOR [CD_USU]

ALTER TABLE [dbo].[RC_CLI_CONV_PBM_EST_PROD_TBL_DESC]  WITH CHECK ADD  CONSTRAINT [FK_RC_CLI_CONV_PBM_EST_PROD_TBL_DESC_EST_PROD_TBL_DESC] FOREIGN KEY([CD_EMP], [CD_TBL_DESC])
REFERENCES [dbo].[EST_PROD_TBL_DESC] ([CD_EMP], [CD_TBL_DESC])

ALTER TABLE [dbo].[RC_CLI_CONV_PBM_EST_PROD_TBL_DESC] CHECK CONSTRAINT [FK_RC_CLI_CONV_PBM_EST_PROD_TBL_DESC_EST_PROD_TBL_DESC]

ALTER TABLE [dbo].[RC_CLI_CONV_PBM_EST_PROD_TBL_DESC]  WITH CHECK ADD  CONSTRAINT [FK_RC_CLI_CONV_PBM_EST_PROD_TBL_DESC_RC_CLI_CONV_PBM] FOREIGN KEY([CD_EMP], [CD_CONV])
REFERENCES [dbo].[RC_CLI_CONV_PBM] ([CD_EMP], [CD_CONV])

ALTER TABLE [dbo].[RC_CLI_CONV_PBM_EST_PROD_TBL_DESC] CHECK CONSTRAINT [FK_RC_CLI_CONV_PBM_EST_PROD_TBL_DESC_RC_CLI_CONV_PBM]
end