IF NOT EXISTS(SELECT * FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME='RC_CLI_GLB_CRM') 
BEGIN
CREATE TABLE [dbo].[RC_CLI_GLB_CRM](
	[CD_EMP] [int] NOT NULL,
	[CD_CLI] [int] NOT NULL,
	[CD_CRM] [int] NOT NULL,
 CONSTRAINT [PK_RC_CLI_GLB_CRM] PRIMARY KEY CLUSTERED 
(
	[CD_EMP] ASC,
	[CD_CLI] ASC,
	[CD_CRM] 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_GLB_CRM]  WITH CHECK ADD  CONSTRAINT [FK_RC_CLI_GLB_CRM_GLB_CRM] FOREIGN KEY([CD_CRM])
REFERENCES [dbo].[GLB_CRM] ([CD_CRM]);

ALTER TABLE [dbo].[RC_CLI_GLB_CRM] CHECK CONSTRAINT [FK_RC_CLI_GLB_CRM_GLB_CRM];
END
