IF	OBJECT_ID('PDV_VD_TEF_CONCILIACAO') IS NULL
begin
CREATE TABLE [dbo].[PDV_VD_TEF_CONCILIACAO](
	[CD_EMP] [int] NOT NULL,
	[CD_FILIAL] [int] NOT NULL,
	[CD_VD] [int] NOT NULL,
	[CD_CTR] [int] NOT NULL,
	[DT_CONCILIACAO] [datetime] NOT NULL,
	[HORA_CONCILIACAO] [datetime] NOT NULL,
	[NR_PROTOCOLO] [varchar](150) NOT NULL,
 CONSTRAINT [PK_PDV_VD_TEF_CONCILIACAO] PRIMARY KEY CLUSTERED 
(
	[CD_EMP] ASC,
	[CD_FILIAL] ASC,
	[CD_VD] ASC,
	[CD_CTR] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 98) ON [PRIMARY]
) ON [PRIMARY]


ALTER TABLE [dbo].[PDV_VD_TEF_CONCILIACAO] ADD  CONSTRAINT [DF_PDV_VD_TEF_CONCILIACAO_NR_PROTOCOLO]  DEFAULT ('') FOR [NR_PROTOCOLO]

ALTER TABLE [dbo].[PDV_VD_TEF_CONCILIACAO]  WITH CHECK ADD  CONSTRAINT [FK_PDV_VD_TEF_CONCILIACAO_PDV_VD_TEF] FOREIGN KEY([CD_EMP], [CD_FILIAL], [CD_VD], [CD_CTR])
REFERENCES [dbo].[PDV_VD_TEF] ([CD_EMP], [CD_FILIAL], [CD_VD], [CD_CTR])

ALTER TABLE [dbo].[PDV_VD_TEF_CONCILIACAO] CHECK CONSTRAINT [FK_PDV_VD_TEF_CONCILIACAO_PDV_VD_TEF]
end

