/****** Object:  Table [dbo].[EST_NF_ENT_DANFE_PROVISORIO_CIENCIA_OPERACAO]    Script Date: 12/11/2012 14:50:18 ******/
IF  NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[EST_NF_ENT_DANFE_PROVISORIO_CIENCIA_OPERACAO]') AND type in (N'U'))
begin
	CREATE TABLE [dbo].[EST_NF_ENT_DANFE_PROVISORIO_CIENCIA_OPERACAO](
		[CD_CTR] [int] NOT NULL,
		[NR_PROTOCOLO] [varchar](100) NOT NULL,
		[DIG_VALIDACAO] [varchar](100) NOT NULL,
		[DATA_VALIDACAO] [datetime] NOT NULL,
		[DT_CAD] [datetime] NOT NULL,
	 CONSTRAINT [PK_EST_NF_ENT_DANFE_PROVISORIO_CIENCIA_OPERACAO] 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_NF_ENT_DANFE_PROVISORIO_CIENCIA_OPERACAO]  WITH CHECK ADD  CONSTRAINT [FK_EST_NF_ENT_DANFE_PROVISORIO_CIENCIA_OPERACAO_EST_NF_ENT_DANFE_PROVISORIO] FOREIGN KEY([CD_CTR])
	REFERENCES [dbo].[EST_NF_ENT_DANFE_PROVISORIO] ([CD_CTR])

	ALTER TABLE [dbo].[EST_NF_ENT_DANFE_PROVISORIO_CIENCIA_OPERACAO] CHECK CONSTRAINT [FK_EST_NF_ENT_DANFE_PROVISORIO_CIENCIA_OPERACAO_EST_NF_ENT_DANFE_PROVISORIO]

	ALTER TABLE [dbo].[EST_NF_ENT_DANFE_PROVISORIO_CIENCIA_OPERACAO] ADD  CONSTRAINT [DF_EST_NF_ENT_DANFE_PROVISORIO_CIENCIA_OPERACAO_CD_CTR]  DEFAULT ((0)) FOR [CD_CTR]

	ALTER TABLE [dbo].[EST_NF_ENT_DANFE_PROVISORIO_CIENCIA_OPERACAO] ADD  CONSTRAINT [DF_EST_NF_ENT_DANFE_PROVISORIO_CIENCIA_OPERACAO_NR_PROTOCOLO]  DEFAULT ('') FOR [NR_PROTOCOLO]

	ALTER TABLE [dbo].[EST_NF_ENT_DANFE_PROVISORIO_CIENCIA_OPERACAO] ADD  CONSTRAINT [DF_EST_NF_ENT_DANFE_PROVISORIO_CIENCIA_OPERACAO_DIG_VALIDACAO]  DEFAULT ('') FOR [DIG_VALIDACAO]
end

