 
IF  NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[RC_CONC_PDV_VD_TEF]') AND type in (N'U'))
begin
	 
	CREATE TABLE [dbo].[RC_CONC_PDV_VD_TEF](
		
		[CD_EMP] [int] NOT NULL,
		[CD_CTR_LOTE] [int] NOT NULL,
		[CD_FILIAL] [int] NOT NULL, 
		[CD_VD] [int] NOT NULL,
		[DS_LOTE] [varchar](50) NOT NULL,
		[NM_FILIAL] [varchar](50) NOT NULL,	
		[CD_ESTABELECIMENTO] [varchar](50) NOT NULL,	
		[DT_VD] [datetime] NULL, 	
		[CD_ADM_CARTAO] [int] NOT NULL,
		[CD_REDE] [int] NOT NULL,
		[CD_BANDEIRA] [int] NOT NULL,	
		[NM_ADM_CARTAO] [varchar](50) NOT NULL,
		[TP_ADM] [int] NOT NULL,
		[PARC] [int] NOT NULL,	 
		[NR_NSU] [money] NOT NULL,
		[NR_AUTORIZACAO] [nvarchar](50) NOT NULL,
		[NR_ECF] [int] NOT NULL,
		[CHAVE] [varchar](20) NOT NULL,
		[CD_USU] [int] NOT NULL,
		[DT_CAD] [datetime] NULL, 
	 CONSTRAINT [PK_RC_CONC_PDV_VD_TEF] PRIMARY KEY CLUSTERED 
	(
		[CD_VD] ASC,
		[CD_CTR_LOTE] ASC,
		[CD_FILIAL] ASC,
		[CD_EMP] ASC
	)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON, FILLFACTOR = 90) ON [PRIMARY]
	) ON [PRIMARY]
	  
	ALTER TABLE [dbo].[RC_CONC_PDV_VD_TEF] ADD  CONSTRAINT [DF_RC_CONC_PDV_VD_TEF_CD_EMP]  DEFAULT ((0)) FOR [CD_EMP]
	ALTER TABLE [dbo].[RC_CONC_PDV_VD_TEF] ADD  CONSTRAINT [DF_RC_CONC_PDV_VD_TEF_CD_CTR_LOTE]  DEFAULT ((0)) FOR [CD_CTR_LOTE]
	ALTER TABLE [dbo].[RC_CONC_PDV_VD_TEF] ADD  CONSTRAINT [DF_RC_CONC_PDV_VD_TEF_CD_FILIAL]  DEFAULT ((0)) FOR [CD_FILIAL]
	ALTER TABLE [dbo].[RC_CONC_PDV_VD_TEF] ADD  CONSTRAINT [DF_RC_CONC_PDV_VD_TEF_CD_VD]  DEFAULT ((0)) FOR [CD_VD]
	ALTER TABLE [dbo].[RC_CONC_PDV_VD_TEF] ADD  CONSTRAINT [DF_RC_CONC_PDV_VD_TEF_DS_LOTE]  DEFAULT ('') FOR [DS_LOTE]
	ALTER TABLE [dbo].[RC_CONC_PDV_VD_TEF] ADD  CONSTRAINT [DF_RC_CONC_PDV_VD_TEF_NM_FILIAL]  DEFAULT ('') FOR [NM_FILIAL]
	ALTER TABLE [dbo].[RC_CONC_PDV_VD_TEF] ADD  CONSTRAINT [DF_RC_CONC_PDV_VD_TEF_CD_ESTABELECIMENTO]  DEFAULT ('') FOR [CD_ESTABELECIMENTO]
	ALTER TABLE [dbo].[RC_CONC_PDV_VD_TEF] ADD  CONSTRAINT [DF_RC_CONC_PDV_VD_TEF_CD_ADM_CARTAO]  DEFAULT ((0)) FOR [CD_ADM_CARTAO]
	ALTER TABLE [dbo].[RC_CONC_PDV_VD_TEF] ADD  CONSTRAINT [DF_RC_CONC_PDV_VD_TEF_CD_REDE]  DEFAULT ((0)) FOR [CD_REDE]
	ALTER TABLE [dbo].[RC_CONC_PDV_VD_TEF] ADD  CONSTRAINT [DF_RC_CONC_PDV_VD_TEF_CD_BANDEIRA]  DEFAULT ((0)) FOR [CD_BANDEIRA]
	ALTER TABLE [dbo].[RC_CONC_PDV_VD_TEF] ADD  CONSTRAINT [DF_RC_CONC_PDV_VD_TEF_NM_ADM_CARTAO]  DEFAULT ('') FOR [NM_ADM_CARTAO]
	ALTER TABLE [dbo].[RC_CONC_PDV_VD_TEF] ADD  CONSTRAINT [DF_RC_CONC_PDV_VD_TEF_TP_ADM]  DEFAULT ((0)) FOR [TP_ADM]  
	ALTER TABLE [dbo].[RC_CONC_PDV_VD_TEF] ADD  CONSTRAINT [DF_RC_CONC_PDV_VD_TEF_PARC]  DEFAULT ((0)) FOR [PARC] 
	ALTER TABLE [dbo].[RC_CONC_PDV_VD_TEF] ADD  CONSTRAINT [DF_RC_CONC_PDV_VD_TEF_NR_NSU]  DEFAULT ((0)) FOR [NR_NSU] 
	ALTER TABLE [dbo].[RC_CONC_PDV_VD_TEF] ADD  CONSTRAINT [DF_RC_CONC_PDV_VD_TEF_NR_AUTORIZACAO]  DEFAULT ('') FOR [NR_AUTORIZACAO] 
	ALTER TABLE [dbo].[RC_CONC_PDV_VD_TEF] ADD  CONSTRAINT [DF_RC_CONC_PDV_VD_TEF_NR_ECF]  DEFAULT ((0)) FOR [NR_ECF]
	ALTER TABLE [dbo].[RC_CONC_PDV_VD_TEF] ADD  CONSTRAINT [DF_RC_CONC_PDV_VD_TEF_CD_USU]  DEFAULT ((0)) FOR [CD_USU]
	ALTER TABLE [dbo].[RC_CONC_PDV_VD_TEF] ADD  CONSTRAINT [DF_RC_CONC_PDV_VD_TEF_CHAVE]  DEFAULT ('') FOR [CHAVE]
END