USE [EnVisage]
GO

/****** Object:  Table [dbo].[Holiday]    Script Date: 03.06.2014 18:24:31 ******/
if exists (select * from sys.all_objects where object_id = OBJECT_ID('Company2GLDepartment') and type = 'U')
begin
	DROP TABLE [dbo].[Company2GLDepartment]
end
GO

/****** Object:  Table [dbo].[Holiday]    Script Date: 03.06.2014 18:24:31 ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

CREATE TABLE [dbo].[Company2GLDepartment](
	[Id] [uniqueidentifier] NOT NULL,
	[CompanyId] [uniqueidentifier] NOT NULL,
	[GLDepartmentId] [uniqueidentifier] NOT NULL
 CONSTRAINT [PK_Company2GLDepartment] PRIMARY KEY CLUSTERED 
(
	[Id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]

GO

ALTER TABLE [dbo].[Company2GLDepartment]  WITH CHECK ADD  CONSTRAINT [FK_Company2GLDepartment_CompanyId] FOREIGN KEY([CompanyId])
REFERENCES [dbo].[Company] ([Id])
GO

ALTER TABLE [dbo].[Company2GLDepartment] CHECK CONSTRAINT [FK_Company2GLDepartment_CompanyId]
GO

ALTER TABLE [dbo].[Company2GLDepartment]  WITH CHECK ADD  CONSTRAINT [FK_Company2GLDepartment_GLDepartmentId] FOREIGN KEY([GLDepartmentId])
REFERENCES [dbo].[GLDepartment] ([Id])
GO

ALTER TABLE [dbo].[Company2GLDepartment] CHECK CONSTRAINT [FK_Company2GLDepartment_GLDepartmentId]
GO

