IF  NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[BC_ADIANT]') AND type in (N'U'))
begin
CREATE TABLE [dbo].[BC_ADIANT](
	[CD_ADIANT] [int] NOT NULL,
	[DT_ADIANT] [datetime] NULL,
	[CD_PROJETO] [int] NOT NULL,
	[CD_REQUERENTE] [int] NOT NULL,
	[STS_ADIANT] [int] NOT NULL,
	[VLR_ADIANT] [money] NOT NULL,
	[VLR_TOT_PASSAGEM] [money] NOT NULL,
	[VLR_TOT_HOTEL] [money] NOT NULL,
	[HIST_ADIANT] [varchar](200) NOT NULL,
	[CD_USU] [int] NOT NULL,
	[DT_CAD] [datetime] NULL,
	[DT_ULT_ALT] [datetime] NULL,
 CONSTRAINT [PK_BC_ADIANT] PRIMARY KEY CLUSTERED 
(
	[CD_ADIANT] 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].[BC_ADIANT]  WITH CHECK ADD  CONSTRAINT [FK_BC_ADIANT_GLB_PROJETO] FOREIGN KEY([CD_PROJETO])
REFERENCES [dbo].[GLB_PROJETO] ([CD_CTR])
ON UPDATE CASCADE

ALTER TABLE [dbo].[BC_ADIANT] CHECK CONSTRAINT [FK_BC_ADIANT_GLB_PROJETO]

ALTER TABLE [dbo].[BC_ADIANT]  WITH CHECK ADD  CONSTRAINT [FK_BC_ADIANT_GLB_REQUERENTE] FOREIGN KEY([CD_REQUERENTE])
REFERENCES [dbo].[GLB_REQUERENTE] ([CD_REQUERENTE])
ON UPDATE CASCADE

ALTER TABLE [dbo].[BC_ADIANT] CHECK CONSTRAINT [FK_BC_ADIANT_GLB_REQUERENTE]

ALTER TABLE [dbo].[BC_ADIANT] ADD  CONSTRAINT [DF_BC_ADIANT_CD_ADIANT]  DEFAULT ((0)) FOR [CD_ADIANT]

ALTER TABLE [dbo].[BC_ADIANT] ADD  CONSTRAINT [DF_BC_ADIANT_CD_PROJETO]  DEFAULT ((0)) FOR [CD_PROJETO]

ALTER TABLE [dbo].[BC_ADIANT] ADD  CONSTRAINT [DF_BC_ADIANT_CD_REQUERENTE]  DEFAULT ((0)) FOR [CD_REQUERENTE]

ALTER TABLE [dbo].[BC_ADIANT] ADD  CONSTRAINT [DF_BC_ADIANT_STS_ADIANT]  DEFAULT ((0)) FOR [STS_ADIANT]

ALTER TABLE [dbo].[BC_ADIANT] ADD  CONSTRAINT [DF_BC_ADIANT_VLR_ADIANT]  DEFAULT ((0)) FOR [VLR_ADIANT]

ALTER TABLE [dbo].[BC_ADIANT] ADD  CONSTRAINT [DF_BC_ADIANT_VLR_TOT_PASSAGEM]  DEFAULT ((0)) FOR [VLR_TOT_PASSAGEM]

ALTER TABLE [dbo].[BC_ADIANT] ADD  CONSTRAINT [DF_BC_ADIANT_VLR_TOT_HOTEL]  DEFAULT ((0)) FOR [VLR_TOT_HOTEL]

ALTER TABLE [dbo].[BC_ADIANT] ADD  CONSTRAINT [DF_BC_ADIANT_HIST_ADIANT]  DEFAULT ('') FOR [HIST_ADIANT]

ALTER TABLE [dbo].[BC_ADIANT] ADD  CONSTRAINT [DF_BC_ADIANT_CD_USU]  DEFAULT ((0)) FOR [CD_USU]
end

