IF NOT EXISTS(SELECT * FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME='PDV_VD_LINX_PROMO_PEND_ESTORNO_PONTOS') 
BEGIN 
    CREATE TABLE DBO.PDV_VD_LINX_PROMO_PEND_ESTORNO_PONTOS(
	    CD_EMP				INT  NOT NULL,
	    CD_FILIAL			INT NOT NULL,
	    CD_VD				INT NOT NULL,
		CD_CTR				INT NOT NULL,
		CD_CX				INT NOT NULL,
		NR_ECF				VARCHAR (40) collate SQL_Latin1_General_CP1_CI_AS NULL,
		DT_VD				DATE NOT NULL,
		STS_EST				INT CONSTRAINT DF_PDV_VD_LINX_PROMO_PEND_ESTORNO_PONTOS_STS_EST DEFAULT 0 NOT NULL, 
		QTDE_PONTOS_EST		MONEY NOT NULL,
		DS_ERRO				VARCHAR(40)collate SQL_Latin1_General_CP1_CI_AS NULL,
		NR_CARTAO_PROMO		VARCHAR(40) collate SQL_Latin1_General_CP1_CI_AS NOT NULL,
		CD_TP_CARTAO_PROMO	VARCHAR(MAX) collate SQL_Latin1_General_CP1_CI_AS NOT NULL,
		DT_PEND_ESTORNO		DATETIME NOT NULL,
		 FLAG_TP_PONTOS 	INT  NULL
	CONSTRAINT PK_PDV_VD_LINX_PROMO_PEND_ESTORNO_PONTOS PRIMARY KEY CLUSTERED 
    (
	    CD_EMP,
		CD_FILIAL,
		CD_VD,
		CD_CTR		
    )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON)  
    )  
END


