
IF OBJECT_ID('RC_CLI_TRANSACAO_PDV_VD') IS NULL 
BEGIN
	CREATE TABLE RC_CLI_TRANSACAO_PDV_VD (
		CD_CTR		BIGINT NOT NULL,
		CD_EMP		INT NOT NULL,
		CD_FILIAL	INT NOT NULL,
		CD_VD		INT NOT NULL,
		DT_CAD		DATETIME CONSTRAINT DF_RC_CLI_TRANSACAO_PDV_VD_DT_CAD DEFAULT GETDATE() NOT NULL,
		CONSTRAINT PK_RC_CLI_TRANSACAO_PDV_VD PRIMARY KEY (CD_CTR),
		CONSTRAINT FK_RC_CLI_TRANSACAO_PDV_VD_PDV_VD FOREIGN KEY (CD_VD,CD_FILIAL,CD_EMP) REFERENCES PDV_VD(CD_VD,CD_FILIAL,CD_EMP),
		CONSTRAINT FK_RC_CLI_TRANSACAO_PDV_VD_RC_CLI_TRANSACAO FOREIGN KEY (CD_CTR) REFERENCES RC_CLI_TRANSACAO(CD_CTR)
	)
END