USE [EnVisage]
GO

/****** Object:  Table [dbo].[Team]    Script Date: 9/18/2014 5:31:44 PM ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

CREATE TABLE [dbo].[Team](
	[Id] [uniqueidentifier] NOT NULL,
	[Name] [nchar](100) NULL,
	[CompanyId] [uniqueidentifier] NULL,
	[ManagerId] [uniqueidentifier] NULL,
	[CostCenterId] [uniqueidentifier] NULL,
	[GLDepartmentId] [uniqueidentifier] NULL,
 CONSTRAINT [PK_Team] 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].[Team]  WITH CHECK ADD  CONSTRAINT [FK_Team_Company] FOREIGN KEY([CompanyId])
REFERENCES [dbo].[Company] ([Id])
GO

ALTER TABLE [dbo].[Team] CHECK CONSTRAINT [FK_Team_Company]
GO

ALTER TABLE [dbo].[Team]  WITH CHECK ADD  CONSTRAINT [FK_Team_CreditDepartment] FOREIGN KEY([CostCenterId])
REFERENCES [dbo].[CreditDepartment] ([Id])
GO

ALTER TABLE [dbo].[Team] CHECK CONSTRAINT [FK_Team_CreditDepartment]
GO

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

ALTER TABLE [dbo].[Team] CHECK CONSTRAINT [FK_Team_GLDepartment]
GO

