IF OBJECT_ID('RC_DEB_RC_CLI_CONVENIADO') IS NULL 
BEGIN
	CREATE TABLE [dbo].[RC_DEB_RC_CLI_CONVENIADO]
	([CD_EMP]    [INT] NOT NULL, 
	 [CD_FILIAL] [INT] NOT NULL, 
	 [CD_RC_DEB] [INT] NOT NULL, 
	 [CD_CONV]   [INT] NOT NULL, 
	 [CD_CLI]    [INT] NOT NULL, 
	 CONSTRAINT [PK_RC_DEB_RC_CLI_CONVENIADO] PRIMARY KEY CLUSTERED([CD_EMP] ASC, [CD_FILIAL] ASC, [CD_RC_DEB] 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 [RC_DEB_RC_CLI_CONVENIADO] WITH CHECK ADD CONSTRAINT [FK_RC_DEB_RC_CLI_CONVENIADO_RC_DEB] FOREIGN KEY ([CD_EMP], [CD_FILIAL], [CD_RC_DEB])
			REFERENCES [RC_DEB] ([CD_EMP], [CD_FILIAL], [CD_RC_DEB]) 


	 ALTER TABLE [RC_DEB_RC_CLI_CONVENIADO] WITH CHECK ADD CONSTRAINT [FK_RC_DEB_RC_CLI_CONVENIADO_RC_CLI] FOREIGN KEY ([CD_EMP],  [CD_CLI])
			REFERENCES [RC_CLI] ([CD_EMP], [CD_CLI]) 

END;
