IF OBJECT_ID('EST_PROD_TRANSF_CROSS_DOCKING') IS NULL
BEGIN
CREATE TABLE [dbo].[EST_PROD_TRANSF_CROSS_DOCKING](
	[CD_EMP] [int] NOT NULL,
	[CD_FILIAL] [int] NOT NULL,
	[CD_CTR] [int] NOT NULL,
	[CD_FILIAL_ORIG] [int] NOT NULL,
	[CD_CTR_ORIG] [int] NOT NULL,
 CONSTRAINT [PK_EST_PROD_TRANSF_CROSS_DOCKING] PRIMARY KEY CLUSTERED 
(
	[CD_EMP] ASC,
	[CD_FILIAL] ASC,
	[CD_CTR] 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].[EST_PROD_TRANSF_CROSS_DOCKING]  WITH CHECK ADD  CONSTRAINT [FK_EST_PROD_TRANSF_CROSS_DOCKING_EST_PROD_TRANSF] FOREIGN KEY([CD_EMP], [CD_FILIAL_ORIG], [CD_CTR_ORIG])
REFERENCES [dbo].[EST_PROD_TRANSF] ([CD_EMP], [CD_FILIAL], [CD_CTR])

ALTER TABLE [dbo].[EST_PROD_TRANSF_CROSS_DOCKING] CHECK CONSTRAINT [FK_EST_PROD_TRANSF_CROSS_DOCKING_EST_PROD_TRANSF]

ALTER TABLE [dbo].[EST_PROD_TRANSF_CROSS_DOCKING]  WITH CHECK ADD  CONSTRAINT [FK_EST_PROD_TRANSF_CROSS_DOCKING_EST_PROD_TRANSF1] FOREIGN KEY([CD_EMP], [CD_FILIAL], [CD_CTR])
REFERENCES [dbo].[EST_PROD_TRANSF] ([CD_EMP], [CD_FILIAL], [CD_CTR])

ALTER TABLE [dbo].[EST_PROD_TRANSF_CROSS_DOCKING] CHECK CONSTRAINT [FK_EST_PROD_TRANSF_CROSS_DOCKING_EST_PROD_TRANSF1]
end

