IF OBJECT_ID('EST_PED_ELTR_EST_NF_ENT_DANFE_PROVISORIO') IS NULL
begin
CREATE TABLE [dbo].[EST_PED_ELTR_EST_NF_ENT_DANFE_PROVISORIO](
	[CD_EMP] [int] NOT NULL,
	[CD_PED_SOL] [int] NOT NULL,
	[CD_CTR] [int] NOT NULL,
 CONSTRAINT [PK_EST_PED_ELTR_EST_NF_ENT_DANFE_PROVISORIO] PRIMARY KEY CLUSTERED 
(
	[CD_EMP] ASC,
	[CD_PED_SOL] 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_PED_ELTR_EST_NF_ENT_DANFE_PROVISORIO]  WITH CHECK ADD  CONSTRAINT [FK_EST_PED_ELTR_EST_NF_ENT_DANFE_PROVISORIO_EST_NF_ENT_DANFE_PROVISORIO] FOREIGN KEY([CD_CTR])
REFERENCES [dbo].[EST_NF_ENT_DANFE_PROVISORIO] ([CD_CTR])

ALTER TABLE [dbo].[EST_PED_ELTR_EST_NF_ENT_DANFE_PROVISORIO] CHECK CONSTRAINT [FK_EST_PED_ELTR_EST_NF_ENT_DANFE_PROVISORIO_EST_NF_ENT_DANFE_PROVISORIO]

ALTER TABLE [dbo].[EST_PED_ELTR_EST_NF_ENT_DANFE_PROVISORIO]  WITH CHECK ADD  CONSTRAINT [FK_EST_PED_ELTR_EST_NF_ENT_DANFE_PROVISORIO_EST_PED_ELTR] FOREIGN KEY([CD_EMP], [CD_PED_SOL])
REFERENCES [dbo].[EST_PED_ELTR] ([CD_EMP], [CD_PED_SOL])

ALTER TABLE [dbo].[EST_PED_ELTR_EST_NF_ENT_DANFE_PROVISORIO] CHECK CONSTRAINT [FK_EST_PED_ELTR_EST_NF_ENT_DANFE_PROVISORIO_EST_PED_ELTR]
end

