
IF NOT EXISTS (SELECT * FROM SYS.OBJECTS WHERE OBJECT_ID = OBJECT_ID(N'DBO.PDV_VD_DEV_NCC_PDV_VD_LINX_PROMO') AND TYPE IN (N'U'))
BEGIN
	CREATE TABLE  PDV_VD_DEV_NCC_PDV_VD_LINX_PROMO(
		CD_CTR_NCC	[int] NOT NULL,
		CD_EMP 		[int] NOT NULL,
		CD_FILIAL 	[int] NOT NULL,
		CD_CX		[int] NOT NULL,
		DT_VD		[DATETIME] NOT NULL,
		NR_ECF		[int] NOT NULL,
	   CONSTRAINT PK_PDV_VD_DEV_NCC_PDV_VD_LINX_PROMO PRIMARY KEY (CD_CTR_NCC)
	)
END
IF NOT EXISTS (SELECT TOP 1 * FROM PDV_VD_DEV_NCC_PDV_VD_LINX_PROMO )
BEGIN 
	DROP TABLE PDV_VD_DEV_NCC_PDV_VD_LINX_PROMO

	CREATE TABLE  PDV_VD_DEV_NCC_PDV_VD_LINX_PROMO(
		CD_CTR_NCC	[int] NOT NULL,
		CD_EMP 		[int] NOT NULL,
		CD_FILIAL 	[int] NOT NULL,
		CD_CX		[int] NOT NULL,
		DT_VD		[DATETIME] NOT NULL,
		NR_ECF		[int] NOT NULL,
	   CONSTRAINT PK_PDV_VD_DEV_NCC_PDV_VD_LINX_PROMO PRIMARY KEY (CD_CTR_NCC)
	)
END