IF NOT EXISTS (SELECT * FROM SYS.TABLES WHERE NAME = 'EST_PED_VD_DEV_RESSARCIMENTO')
Begin 
-- drop table EST_PED_VD_DEV_RESSARCIMENTO

CREATE TABLE EST_PED_VD_DEV_RESSARCIMENTO(
	CD_EMP		int NOT NULL,
	CD_FILIAL	int NOT NULL,
	CD_NF		int NOT NULL,
	CD_CTR		int NOT NULL,
	CD_PED		int NOT NULL,
	TIPO		int NOT NULL, -- 0 - PRE-FATURA DE DEVOLUÇÃO, 1 - PRE-FATURA DE RESSARCIMENTO, 2 - PRE-FATURA ADJUDICACAO
	CONSTRAINT [PK_EST_PED_VD_DEV_RESSARCIMENTO] PRIMARY KEY CLUSTERED (CD_EMP ASC, CD_FILIAL ASC, CD_NF ASC, CD_CTR ASC, CD_PED ASC)
	WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 80) ON [PRIMARY]
) ON [PRIMARY]
end
