/****** Object:  Table [dbo].[EST_PED_CP_AGENDA_ENTREGA_AUDIT]    Script Date: 03/31/2014 15:40:41 ******/
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[EST_PED_CP_AGENDA_ENTREGA_AUDIT]') AND type in (N'U'))
DROP TABLE [dbo].[EST_PED_CP_AGENDA_ENTREGA_AUDIT]
GO
GO
GO

CREATE TABLE [dbo].[EST_PED_CP_AGENDA_ENTREGA_AUDIT](
	[CD_CTR] [int] IDENTITY(1,1) NOT NULL,
	[CD_EMP] [int] NOT NULL,
	[CD_FILIAL] [int] NOT NULL,
	[CD_PED] [int] NOT NULL,
	[DT_AGENDA_ENTREGA] [datetime] NOT NULL,
	[CD_USU] [int] NOT NULL,
	[QTDE_VOLUMES_AGENDADO] [int] NOT NULL,
	[QTDE_VOLUMES_RECEBIDOS] [int] NOT NULL,
	[ORDEM] [int] NOT NULL,
	[DT_AGENDA_SOLICITACAO] [datetime] NOT NULL,
	[DT_AGENDA_RESPOSTA] [datetime] NULL,
	[NR_NF] [int] NOT NULL,
	[OBS] [varchar](250) NOT NULL,
	[DT_EMI_NF] [datetime] NOT NULL,
	[CD_FORN] [int] NOT NULL,	
 CONSTRAINT [PK_EST_PED_CP_AGENDA_ENTREGA_AUDIT] PRIMARY KEY CLUSTERED 
(
	[CD_CTR] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]

ALTER TABLE [dbo].[EST_PED_CP_AGENDA_ENTREGA_AUDIT] ADD  CONSTRAINT [DF_EST_PED_CP_AGENDA_ENTREGA_AUDIT_CD_EMP]  DEFAULT ((0)) FOR [CD_EMP]

ALTER TABLE [dbo].[EST_PED_CP_AGENDA_ENTREGA_AUDIT] ADD  CONSTRAINT [DF_EST_PED_CP_AGENDA_ENTREGA_AUDIT_CD_FILIAL]  DEFAULT ((0)) FOR [CD_FILIAL]

ALTER TABLE [dbo].[EST_PED_CP_AGENDA_ENTREGA_AUDIT] ADD  CONSTRAINT [DF_EST_PED_CP_AGENDA_ENTREGA_AUDIT_CD_PED]  DEFAULT ((0)) FOR [CD_PED]

ALTER TABLE [dbo].[EST_PED_CP_AGENDA_ENTREGA_AUDIT] ADD  CONSTRAINT [DF_EST_PED_CP_AGENDA_ENTREGA_AUDIT_CD_USU]  DEFAULT ((0)) FOR [CD_USU]

ALTER TABLE [dbo].[EST_PED_CP_AGENDA_ENTREGA_AUDIT] ADD  CONSTRAINT [DF_EST_PED_CP_AGENDA_ENTREGA_AUDIT_QTDE_VOLUMES_AGENDADO]  DEFAULT ((0)) FOR [QTDE_VOLUMES_AGENDADO]

ALTER TABLE [dbo].[EST_PED_CP_AGENDA_ENTREGA_AUDIT] ADD  CONSTRAINT [DF_EST_PED_CP_AGENDA_ENTREGA_AUDIT_QTDE_VOLUMES_RECEBIDOS]  DEFAULT ((0)) FOR [QTDE_VOLUMES_RECEBIDOS]

ALTER TABLE [dbo].[EST_PED_CP_AGENDA_ENTREGA_AUDIT] ADD  CONSTRAINT [DF_EST_PED_CP_AGENDA_ENTREGA_AUDIT_ORDEM]  DEFAULT ((0)) FOR [ORDEM]

ALTER TABLE [dbo].[EST_PED_CP_AGENDA_ENTREGA_AUDIT] ADD  CONSTRAINT [DF_EST_PED_CP_AGENDA_ENTREGA_AUDIT_DT_AGENDA_SOLICITACAO]  DEFAULT (getdate()) FOR [DT_AGENDA_SOLICITACAO]

ALTER TABLE [dbo].[EST_PED_CP_AGENDA_ENTREGA_AUDIT] ADD  CONSTRAINT [DF_EST_PED_CP_AGENDA_ENTREGA_AUDIT_NR_NF]  DEFAULT ((0)) FOR [NR_NF]

ALTER TABLE [dbo].[EST_PED_CP_AGENDA_ENTREGA_AUDIT] ADD  CONSTRAINT [DF_EST_PED_CP_AGENDA_ENTREGA_AUDIT_OBS]  DEFAULT ('') FOR [OBS]

ALTER TABLE [dbo].[EST_PED_CP_AGENDA_ENTREGA_AUDIT] ADD  CONSTRAINT [DF_EST_PED_CP_AGENDA_ENTREGA_AUDIT_CD_FORN]  DEFAULT ((0)) FOR [CD_FORN]
