/****** Object:  Table [dbo].[BC_ADIANT_BC_LANC]    Script Date: 09/18/2013 15:18:31 ******/
IF  NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[BC_ADIANT_BC_LANC]') AND type in (N'U'))
begin
CREATE TABLE [dbo].[BC_ADIANT_BC_LANC](
	[CD_EMP] [int] NOT NULL,
	[CD_BC_LANC] [int] NOT NULL,
	[CD_ADIANT] [int] NOT NULL,
 CONSTRAINT [PK_BC_ADIANT_BC_LANC] PRIMARY KEY CLUSTERED 
(
	[CD_EMP] ASC,
	[CD_BC_LANC] ASC,
	[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_BC_LANC]  WITH CHECK ADD  CONSTRAINT [FK_BC_ADIANT_BC_LANC_BC_ADIANT] FOREIGN KEY([CD_ADIANT])
REFERENCES [dbo].[BC_ADIANT] ([CD_ADIANT])

ALTER TABLE [dbo].[BC_ADIANT_BC_LANC] CHECK CONSTRAINT [FK_BC_ADIANT_BC_LANC_BC_ADIANT]

ALTER TABLE [dbo].[BC_ADIANT_BC_LANC]  WITH CHECK ADD  CONSTRAINT [FK_BC_ADIANT_BC_LANC_BC_ADIANT_BC_LANC] FOREIGN KEY([CD_EMP], [CD_BC_LANC])
REFERENCES [dbo].[BC_LANC] ([CD_EMP], [CD_BC_LANC])

ALTER TABLE [dbo].[BC_ADIANT_BC_LANC] CHECK CONSTRAINT [FK_BC_ADIANT_BC_LANC_BC_ADIANT_BC_LANC]

ALTER TABLE [dbo].[BC_ADIANT_BC_LANC] ADD  CONSTRAINT [DF_BC_ADIANT_BC_LANC_CD_EMP]  DEFAULT ((0)) FOR [CD_EMP]

ALTER TABLE [dbo].[BC_ADIANT_BC_LANC] ADD  CONSTRAINT [DF_BC_ADIANT_BC_LANC_CD_BC]  DEFAULT ((0)) FOR [CD_BC_LANC]

ALTER TABLE [dbo].[BC_ADIANT_BC_LANC] ADD  CONSTRAINT [DF_BC_ADIANT_BC_LANC_CD_ADIANT]  DEFAULT ((0)) FOR [CD_ADIANT]
end