IF OBJECT_ID('EST_PED_CP_PARAM_EST_ARV_MERC_LINHA') IS NULL
	BEGIN 
		CREATE TABLE [dbo].[EST_PED_CP_PARAM_EST_ARV_MERC_LINHA](
			[CD_EMP] [int] NOT NULL,
			[CD_PED_CP_PARAM] [int] NOT NULL,
			[CD_ARV_MERC_LINHA] [int] NOT NULL,
			[ST_IGNORA] [int] NOT NULL,
		 CONSTRAINT [PK_EST_PED_CP_PARAM_EST_ARV_MERC_LINHA] PRIMARY KEY CLUSTERED 
		(
			[CD_EMP] ASC,
			[CD_PED_CP_PARAM] ASC,
			[CD_ARV_MERC_LINHA] ASC
		)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON, FILLFACTOR = 90) ON [PRIMARY]
		) ON [PRIMARY]

		

		ALTER TABLE [dbo].[EST_PED_CP_PARAM_EST_ARV_MERC_LINHA]  WITH CHECK ADD  CONSTRAINT [FK_EST_PED_CP_PARAM_EST_ARV_MERC_LINHA_EST_ARV_MERC_LINHA] FOREIGN KEY([CD_ARV_MERC_LINHA], [CD_EMP])
		REFERENCES [dbo].[EST_ARV_MERC_LINHA] ([CD_ARV_MERC_LINHA], [CD_EMP])
		ON UPDATE CASCADE
		

		ALTER TABLE [dbo].[EST_PED_CP_PARAM_EST_ARV_MERC_LINHA] CHECK CONSTRAINT [FK_EST_PED_CP_PARAM_EST_ARV_MERC_LINHA_EST_ARV_MERC_LINHA]
		

		ALTER TABLE [dbo].[EST_PED_CP_PARAM_EST_ARV_MERC_LINHA]  WITH CHECK ADD  CONSTRAINT [FK_EST_PED_CP_PARAM_EST_ARV_MERC_LINHA_EST_PED_CP_PARAM] FOREIGN KEY([CD_EMP], [CD_PED_CP_PARAM])
		REFERENCES [dbo].[EST_PED_CP_PARAM] ([CD_EMP], [CD_PED_CP_PARAM])
		ON UPDATE CASCADE
		ON DELETE CASCADE
		

		ALTER TABLE [dbo].[EST_PED_CP_PARAM_EST_ARV_MERC_LINHA] CHECK CONSTRAINT [FK_EST_PED_CP_PARAM_EST_ARV_MERC_LINHA_EST_PED_CP_PARAM]
		

		ALTER TABLE [dbo].[EST_PED_CP_PARAM_EST_ARV_MERC_LINHA] ADD  CONSTRAINT [DF_EST_PED_CP_PARAM_EST_ARV_MERC_LINHA_ST_IGNORA]  DEFAULT ((0)) FOR [ST_IGNORA]
		
	END
