/****** Object:  Table [dbo].[Report]    Script Date: 11/16/2010 14:07:59 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [Report](
	[ReportId] [uniqueidentifier] NOT NULL,
	[Name] [nvarchar](255) NOT NULL,
	[Data] [image] NOT NULL,
	[ShowInActions] [bit] NOT NULL,
	[ShowInMindMap] [bit] NOT NULL,
	[ShowInPlanning] [bit] NOT NULL,
	[ShowInDocuments] [bit] NOT NULL,
	[ShowInBudgets] [bit] NOT NULL,
	[LockedBySid] [nvarchar](50) NULL,
PRIMARY KEY CLUSTERED 
(
	[ReportId] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[WorkingTimeDayOff]    Script Date: 11/16/2010 14:07:59 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [WorkingTimeDayOff](
	[WorkingTimeDayOffId] [uniqueidentifier] NOT NULL,
	[Name] [nvarchar](200) NOT NULL,
	[StartTime] [datetime] NOT NULL,
	[EndTime] [datetime] NOT NULL,
PRIMARY KEY CLUSTERED 
(
	[WorkingTimeDayOffId] 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
/****** Object:  Table [dbo].[WorkingTime]    Script Date: 11/16/2010 14:07:59 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [WorkingTime](
	[WorkingTimeId] [uniqueidentifier] NOT NULL,
	[WeekDay] [int] NOT NULL,
	[StartTime] [datetime] NOT NULL,
	[EndTime] [datetime] NOT NULL,
	[IsWorkDay] [bit] NOT NULL,
	[OrdinalPosition] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[WorkingTimeId] 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
/****** Object:  Table [dbo].[View]    Script Date: 11/16/2010 14:07:59 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [View](
	[ViewId] [uniqueidentifier] NOT NULL,
	[ContactId] [uniqueidentifier] NOT NULL,
	[Name] [nvarchar](255) NOT NULL,
	[Data] [image] NULL,
	[IsGlobalView] [bit] NULL,
	[Type] [int] NOT NULL,
PRIMARY KEY CLUSTERED 
(
	[ViewId] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[UserPermission]    Script Date: 11/16/2010 14:07:59 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [UserPermission](
	[UserPermissionId] [uniqueidentifier] NOT NULL,
	[UserSid] [nvarchar](50) NOT NULL,
	[ProjectRead] [bit] NOT NULL,
	[ProjectModify] [bit] NOT NULL,
	[ProjectDelete] [bit] NOT NULL,
	[ProjectLock] [bit] NOT NULL,
	[ContactModify] [bit] NOT NULL,
	[ManageAccess] [bit] NOT NULL,
	[MindMapAccess] [bit] NOT NULL,
	[PlanningAccess] [bit] NOT NULL,
	[DocumentAccess] [bit] NOT NULL,
	[BudgetAccess] [bit] NOT NULL,
	[ReportRead] [bit] NOT NULL,
	[ReportModify] [bit] NOT NULL,
	[PermissionsAdministrate] [bit] NOT NULL,
	[ManageModify] [bit] NOT NULL,
	[MindMapModify] [bit] NOT NULL,
	[PlanningModify] [bit] NOT NULL,
	[DocumentModify] [bit] NOT NULL,
	[BudgetModify] [bit] NOT NULL,
	[ActionAccess] [bit] NOT NULL,
	[UserActionAccess] [bit] NOT NULL,
	[ActionModify] [bit] NOT NULL,
	[UserActionModify] [bit] NOT NULL,
	[FreeActionModify] [bit] NOT NULL,
	[ProjectCreate] [bit] NOT NULL,
	[LockedBySid] [nvarchar](50) NULL,
PRIMARY KEY CLUSTERED 
(
	[UserPermissionId] 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
/****** Object:  Table [dbo].[UserDefault]    Script Date: 11/16/2010 14:07:59 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [UserDefault](
	[UserDefaultId] [uniqueidentifier] NOT NULL,
	[Sid] [nvarchar](255) NULL,
	[Key] [nvarchar](255) NOT NULL,
	[Value] [image] NOT NULL,
PRIMARY KEY CLUSTERED 
(
	[UserDefaultId] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[RolePermission]    Script Date: 11/16/2010 14:07:59 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [RolePermission](
	[RolePermissionId] [uniqueidentifier] NOT NULL,
	[RoleType] [int] NOT NULL,
	[ProjectRead] [bit] NOT NULL,
	[ProjectModify] [bit] NOT NULL,
	[ProjectDelete] [bit] NOT NULL,
	[ProjectLock] [bit] NOT NULL,
	[ContactModify] [bit] NOT NULL,
	[ManageAccess] [bit] NOT NULL,
	[MindMapAccess] [bit] NOT NULL,
	[PlanningAccess] [bit] NOT NULL,
	[DocumentAccess] [bit] NOT NULL,
	[BudgetAccess] [bit] NOT NULL,
	[ReportRead] [bit] NOT NULL,
	[ManageModify] [bit] NOT NULL,
	[MindMapModify] [bit] NOT NULL,
	[PlanningModify] [bit] NOT NULL,
	[DocumentModify] [bit] NOT NULL,
	[BudgetModify] [bit] NOT NULL,
	[ActionAccess] [bit] NOT NULL,
	[UserActionAccess] [bit] NOT NULL,
	[ActionModify] [bit] NOT NULL,
	[UserActionModify] [bit] NOT NULL,
	[FreeActionModify] [bit] NOT NULL,
PRIMARY KEY CLUSTERED 
(
	[RolePermissionId] 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
/****** Object:  Table [dbo].[PlanningTemplate]    Script Date: 11/16/2010 14:07:59 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [PlanningTemplate](
	[PlanningTemplateId] [uniqueidentifier] NOT NULL,
	[Name] [nvarchar](50) NOT NULL,
	[Data] [image] NOT NULL,
PRIMARY KEY CLUSTERED 
(
	[PlanningTemplateId] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[ProjectStatus]    Script Date: 11/16/2010 14:07:59 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [ProjectStatus](
	[ProjectStatusId] [uniqueidentifier] NOT NULL,
	[Name] [nvarchar](255) NOT NULL,
	[Progress] [int] NOT NULL,
	[OrdinalPosition] [int] NOT NULL,
PRIMARY KEY CLUSTERED 
(
	[ProjectStatusId] 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
/****** Object:  Table [dbo].[BudgetPositionTemplate]    Script Date: 11/16/2010 14:07:59 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [BudgetPositionTemplate](
	[BudgetPositionTemplateId] [uniqueidentifier] NOT NULL,
	[ShortDescription] [nvarchar](255) NOT NULL,
	[LongDescription] [ntext] NULL,
	[Quantity] [float] NOT NULL,
	[LockedBySid] [nvarchar](50) NULL,
PRIMARY KEY CLUSTERED 
(
	[BudgetPositionTemplateId] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[Division]    Script Date: 11/16/2010 14:07:59 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [Division](
	[DivisionId] [uniqueidentifier] NOT NULL,
	[ParentDivisionId] [uniqueidentifier] NULL,
	[DisplayName] [nvarchar](255) NOT NULL,
	[PositionNumber] [int] NOT NULL,
	[Description] [ntext] NULL,
PRIMARY KEY CLUSTERED 
(
	[DivisionId] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[CustomExpandDefault]    Script Date: 11/16/2010 14:07:59 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [CustomExpandDefault](
	[CustomExpandDefaultId] [uniqueidentifier] NOT NULL,
	[TableName] [nvarchar](255) NOT NULL,
	[ColumnName] [nvarchar](255) NOT NULL,
	[Type] [nvarchar](255) NOT NULL,
	[Value] [image] NULL,
	[LockedBySid] [nvarchar](50) NULL,
PRIMARY KEY CLUSTERED 
(
	[CustomExpandDefaultId] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[CostUnit]    Script Date: 11/16/2010 14:07:59 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [CostUnit](
	[CostUnitId] [uniqueidentifier] NOT NULL,
	[Number] [nvarchar](50) NOT NULL,
	[Name] [nvarchar](255) NOT NULL,
PRIMARY KEY CLUSTERED 
(
	[CostUnitId] 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
/****** Object:  Table [dbo].[Contact]    Script Date: 11/16/2010 14:07:59 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [Contact](
	[ContactId] [uniqueidentifier] NOT NULL,
	[Name] [nvarchar](255) NULL,
	[EntryId] [nvarchar](1000) NOT NULL,
	[Address] [nvarchar](255) NULL,
	[Sid] [nvarchar](255) NULL,
	[Type] [nvarchar](255) NULL,
	[Title] [nvarchar](255) NULL,
	[FirstName] [nvarchar](255) NULL,
	[LastName] [nvarchar](255) NULL,
	[CompanyName] [nvarchar](255) NULL,
	[Street] [nvarchar](255) NULL,
	[Zip] [nvarchar](255) NULL,
	[Location] [nvarchar](255) NULL,
	[Country] [nvarchar](255) NULL,
	[DisplayName] [nvarchar](255) NULL,
	[Initials] [nvarchar](255) NULL,
	[Department] [nvarchar](255) NULL,
	[Assistenz] [nvarchar](255) NULL,
	[Phone] [nvarchar](255) NULL,
	[Phone2] [nvarchar](255) NULL,
	[Fax] [nvarchar](255) NULL,
	[Mobile] [nvarchar](255) NULL,
	[Pager] [nvarchar](255) NULL,
	[Notes] [ntext] NULL,
	[Email] [nvarchar](255) NULL,
PRIMARY KEY CLUSTERED 
(
	[ContactId] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
CREATE NONCLUSTERED INDEX [idx_con_1] ON [Contact] 
(
	[ContactId] ASC,
	[Name] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
GO
CREATE NONCLUSTERED INDEX [idx_con_2] ON [Contact] 
(
	[Address] ASC,
	[ContactId] ASC
)
INCLUDE ( [FirstName],
[LastName]) WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[Configuration]    Script Date: 11/16/2010 14:07:59 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [Configuration](
	[ConfigurationId] [uniqueidentifier] NOT NULL,
	[Key] [nvarchar](100) NOT NULL,
	[Value] [nvarchar](1000) NULL,
PRIMARY KEY CLUSTERED 
(
	[ConfigurationId] 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
/****** Object:  Table [dbo].[ColorFlag]    Script Date: 11/16/2010 14:07:59 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [ColorFlag](
	[ColorFlagId] [uniqueidentifier] NOT NULL,
	[Name] [nvarchar](50) NOT NULL,
	[OrdinalPosition] [int] NOT NULL,
	[MonitorId] [uniqueidentifier] NOT NULL,
PRIMARY KEY CLUSTERED 
(
	[ColorFlagId] 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
/****** Object:  Table [dbo].[ClientLicense]    Script Date: 11/16/2010 14:07:59 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [ClientLicense](
	[ClientLicenseId] [uniqueidentifier] NOT NULL,
	[LicenseKey] [nvarchar](100) NOT NULL,
	[UserName] [nvarchar](255) NULL,
	[ClientName] [nvarchar](255) NULL,
	[IsTerminalServer] [bit] NULL,
	[AccessedDateTime] [datetime] NULL,
	[ClientGuid] [uniqueidentifier] NULL,
PRIMARY KEY CLUSTERED 
(
	[ClientLicenseId] 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
/****** Object:  Table [dbo].[Client]    Script Date: 11/16/2010 14:07:59 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [Client](
	[ClientId] [uniqueidentifier] NOT NULL,
	[Name] [nvarchar](255) NULL,
	[NumberPrefix] [nvarchar](50) NULL,
	[NumberIncremential] [int] NULL,
	[NumberSuffix] [nvarchar](50) NULL,
	[Number] [nvarchar](50) NOT NULL,
PRIMARY KEY CLUSTERED 
(
	[ClientId] 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
/****** Object:  Table [dbo].[Category]    Script Date: 11/16/2010 14:07:59 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [Category](
	[CategoryId] [uniqueidentifier] NOT NULL,
	[Name] [nvarchar](255) NOT NULL,
PRIMARY KEY CLUSTERED 
(
	[CategoryId] 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
/****** Object:  Table [dbo].[BudgetState]    Script Date: 11/16/2010 14:07:59 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [BudgetState](
	[BudgetStateId] [uniqueidentifier] NOT NULL,
	[Name] [nvarchar](50) NOT NULL,
	[IsHidden] [bit] NOT NULL,
PRIMARY KEY CLUSTERED 
(
	[BudgetStateId] 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
/****** Object:  Table [dbo].[Notification]    Script Date: 11/16/2010 14:07:59 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [Notification](
	[NotificationId] [uniqueidentifier] NOT NULL,
	[Data] [image] NOT NULL,
	[EventType] [int] NOT NULL,
	[ElementType] [int] NOT NULL,
	[LockedBySid] [nvarchar](50) NULL,
PRIMARY KEY CLUSTERED 
(
	[NotificationId] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[MindMapTemplate]    Script Date: 11/16/2010 14:07:59 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [MindMapTemplate](
	[MindMapTemplateId] [uniqueidentifier] NOT NULL,
	[Name] [nvarchar](50) NOT NULL,
	[Data] [image] NOT NULL,
PRIMARY KEY CLUSTERED 
(
	[MindMapTemplateId] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[MasterLicense]    Script Date: 11/16/2010 14:07:59 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [MasterLicense](
	[Description] [nvarchar](16) NULL,
	[MasterLicenseId] [uniqueidentifier] NOT NULL,
	[LicenseKey] [nvarchar](50) NOT NULL,
PRIMARY KEY CLUSTERED 
(
	[MasterLicenseId] 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
/****** Object:  Table [dbo].[Group]    Script Date: 11/16/2010 14:07:59 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [Group](
	[GroupId] [uniqueidentifier] NOT NULL,
	[Name] [nvarchar](50) NOT NULL,
	[PurchasePrice] [float] NULL,
	[DispositionPrice] [float] NULL,
	[OrdinalPosition] [int] NOT NULL,
PRIMARY KEY CLUSTERED 
(
	[GroupId] 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
/****** Object:  Table [dbo].[EmailTemplate]    Script Date: 11/16/2010 14:07:59 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [EmailTemplate](
	[EmailTemplateId] [uniqueidentifier] NOT NULL,
	[Name] [nvarchar](255) NOT NULL,
	[Data] [image] NOT NULL,
	[LockedBySid] [nvarchar](50) NULL,
PRIMARY KEY CLUSTERED 
(
	[EmailTemplateId] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[DivisionWorkingTime]    Script Date: 11/16/2010 14:07:59 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [DivisionWorkingTime](
	[DivisionWorkingTimeId] [uniqueidentifier] NOT NULL,
	[DivisionId] [uniqueidentifier] NOT NULL,
	[Year] [int] NOT NULL,
	[January] [decimal](18, 0) NOT NULL,
	[Februar] [decimal](18, 0) NOT NULL,
	[March] [decimal](18, 0) NOT NULL,
	[April] [decimal](18, 0) NOT NULL,
	[May] [decimal](18, 0) NOT NULL,
	[June] [decimal](18, 0) NOT NULL,
	[July] [decimal](18, 0) NOT NULL,
	[Agust] [decimal](18, 0) NOT NULL,
	[September] [decimal](18, 0) NOT NULL,
	[Octobers] [decimal](18, 0) NOT NULL,
	[November] [decimal](18, 0) NOT NULL,
	[Decembers] [decimal](18, 0) NOT NULL,
PRIMARY KEY CLUSTERED 
(
	[DivisionWorkingTimeId] 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
/****** Object:  Table [dbo].[BudgetPositionTemplatePrice]    Script Date: 11/16/2010 14:07:59 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [BudgetPositionTemplatePrice](
	[BudgetPositionTemplatePriceId] [uniqueidentifier] NOT NULL,
	[BudgetPositionTemplateId] [uniqueidentifier] NOT NULL,
	[Unit] [nvarchar](50) NOT NULL,
	[PurchasePricePerUnit] [float] NOT NULL,
	[DispositionPricePerUnit] [float] NOT NULL,
	[LockedBySid] [nvarchar](50) NULL,
PRIMARY KEY CLUSTERED 
(
	[BudgetPositionTemplatePriceId] 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
/****** Object:  Table [dbo].[BudgetPositionTemplateGroup]    Script Date: 11/16/2010 14:07:59 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [BudgetPositionTemplateGroup](
	[BudgetPositionTemplateGroupId] [uniqueidentifier] NOT NULL,
	[BudgetPositionTemplateId] [uniqueidentifier] NOT NULL,
	[GroupId] [uniqueidentifier] NOT NULL,
	[LockedBySid] [nvarchar](50) NULL,
PRIMARY KEY CLUSTERED 
(
	[BudgetPositionTemplateGroupId] 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
/****** Object:  Table [dbo].[CostUnitRelation]    Script Date: 11/16/2010 14:07:59 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [CostUnitRelation](
	[CostUnitRelationId] [uniqueidentifier] NOT NULL,
	[ContactId] [uniqueidentifier] NOT NULL,
	[CostUnitId] [uniqueidentifier] NOT NULL,
	[Inactive] [bit] NOT NULL,
	[Position] [int] NOT NULL,
PRIMARY KEY CLUSTERED 
(
	[CostUnitRelationId] 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
/****** Object:  Table [dbo].[Project]    Script Date: 11/16/2010 14:07:59 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [Project](
	[ProjectId] [uniqueidentifier] NOT NULL,
	[Name] [nvarchar](255) NULL,
	[NumberPrefix] [nvarchar](50) NULL,
	[NumberIncremential] [int] NULL,
	[NumberSuffix] [nvarchar](50) NULL,
	[Number] [nvarchar](50) NULL,
	[ClientId] [uniqueidentifier] NULL,
	[DivisionId] [uniqueidentifier] NULL,
	[ProjectStatusId] [uniqueidentifier] NULL,
	[ComputedProgress] [float] NULL,
	[Priority] [int] NULL,
	[LockMode] [int] NOT NULL,
	[StartDate] [datetime] NOT NULL,
	[EndDate] [datetime] NOT NULL,
	[IsEndDateFixed] [bit] NOT NULL,
	[Note] [ntext] NULL,
	[NoteRTF] [ntext] NULL,
	[NoteChangedByName] [nvarchar](100) NULL,
	[NoteChangedDateTime] [datetime] NULL,
	[CreatedByName] [nvarchar](100) NULL,
	[CreatedDateTime] [datetime] NULL,
	[LastChangedByName] [nvarchar](100) NULL,
	[LastChangedDateTime] [datetime] NULL,
	[ClosedByName] [nvarchar](100) NULL,
	[ClosedDateTime] [datetime] NULL,
	[Private] [bit] NOT NULL,
	[IsRecycled] [bit] NULL,
	[IsArchived] [bit] NOT NULL,
	[DocumentFolder] [ntext] NULL,
	[IsSPSDocumentStore] [bit] NULL,
	[SPSSite] [nvarchar](255) NULL,
	[SPSDocumentLibrary] [nvarchar](255) NULL,
	[SPSSubfolders] [nvarchar](255) NULL,
	[FirstNotCompletedPlanningDate] [datetime] NULL,
	[FirstManager] [nvarchar](255) NULL,
	[FirstTeamMember] [nvarchar](255) NULL,
	[FirstCustomer] [nvarchar](255) NULL,
	[FirstPartner] [nvarchar](255) NULL,
	[FirstAdditionalContact] [nvarchar](255) NULL,
	[PlannedRevenues] [float] NOT NULL,
	[PlannedCostsResources] [float] NOT NULL,
	[PlannedCostsOther] [float] NOT NULL,
	[ActivityCostAmount] [float] NOT NULL,
	[CostsOther] [float] NOT NULL,
	[Revenues] [float] NOT NULL,
	[AllPositionsBilled] [bit] NULL,
	[LockedBySid] [nvarchar](50) NULL,
PRIMARY KEY CLUSTERED 
(
	[ProjectId] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
CREATE NONCLUSTERED INDEX [idx_pro_1] ON [Project] 
(
	[ProjectId] ASC
)
INCLUDE ( [IsRecycled],
[IsArchived]) WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
GO
CREATE NONCLUSTERED INDEX [idx_pro_2] ON [Project] 
(
	[ProjectId] ASC,
	[IsArchived] ASC,
	[IsRecycled] ASC,
	[LockMode] ASC,
	[ClientId] ASC,
	[ProjectStatusId] ASC
)
INCLUDE ( [Name],
[Number],
[Priority]) WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[DivisionContactRelation]    Script Date: 11/16/2010 14:07:59 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [DivisionContactRelation](
	[DivisionContactRelationId] [uniqueidentifier] NOT NULL,
	[DivisionId] [uniqueidentifier] NOT NULL,
	[ContactId] [uniqueidentifier] NOT NULL,
PRIMARY KEY CLUSTERED 
(
	[DivisionContactRelationId] 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
/****** Object:  Table [dbo].[ReportFilter]    Script Date: 11/16/2010 14:07:59 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [ReportFilter](
	[ReportFilterId] [uniqueidentifier] NOT NULL,
	[UserSid] [nvarchar](50) NOT NULL,
	[Name] [nvarchar](50) NOT NULL,
	[SelectedProjects] [bit] NOT NULL,
	[AllProjects] [bit] NOT NULL,
	[ProjectsMatching] [bit] NOT NULL,
	[ProjectNumberContains] [bit] NOT NULL,
	[ProjectNumberContainsText] [nvarchar](255) NULL,
	[ProjectNameContains] [bit] NOT NULL,
	[ProjectNameContainsText] [nvarchar](255) NULL,
	[ProjectCompanyContains] [bit] NOT NULL,
	[ProjectCompanyContainsText] [nvarchar](255) NULL,
	[ReportId] [uniqueidentifier] NOT NULL,
	[AllActions] [bit] NOT NULL,
	[ActionsMatching] [bit] NOT NULL,
	[ActionDate] [bit] NOT NULL,
	[ActionDateStart] [datetime] NOT NULL,
	[ActionDateEnd] [datetime] NOT NULL,
	[ActionPerformedBy] [bit] NOT NULL,
	[ActionPerformedByText] [nvarchar](255) NULL,
	[ActionGroup] [bit] NOT NULL,
	[GroupId] [uniqueidentifier] NOT NULL,
	[AllPlanningObjects] [bit] NOT NULL,
	[PlanningObjectsMatching] [bit] NOT NULL,
	[PlanningGroups] [bit] NOT NULL,
	[PlanningPhases] [bit] NOT NULL,
	[PlanningMilestones] [bit] NOT NULL,
	[PlanningDate] [bit] NOT NULL,
	[PlanningDateStart] [datetime] NOT NULL,
	[PlanningDateEnd] [datetime] NOT NULL,
	[AllBudgets] [bit] NOT NULL,
	[BudgetsMatching] [bit] NOT NULL,
	[BudgetsActivityCosts] [bit] NOT NULL,
	[BudgetsCalculations] [bit] NOT NULL,
	[BudgetsExpenses] [bit] NOT NULL,
	[BudgetsPlannedCosts] [bit] NOT NULL,
	[BudgetsInvoices] [bit] NOT NULL,
	[BudgetsDate] [bit] NOT NULL,
	[BudgetsDateStart] [datetime] NOT NULL,
	[BudgetsDateEnd] [datetime] NOT NULL,
	[BudgetState] [bit] NOT NULL,
	[BudgetStateId] [uniqueidentifier] NOT NULL,
	[BudgetsAlreadyBilled] [bit] NOT NULL,
	[BudgetsNotYetBilled] [bit] NOT NULL,
	[BudgetsBillable] [bit] NOT NULL,
	[BudgetsNotBillable] [bit] NOT NULL,
PRIMARY KEY CLUSTERED 
(
	[ReportFilterId] 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
/****** Object:  Table [dbo].[Preset]    Script Date: 11/16/2010 14:07:59 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [Preset](
	[PresetId] [uniqueidentifier] NOT NULL,
	[PresetType] [int] NOT NULL,
	[Name] [nvarchar](255) NOT NULL,
	[PresetDate] [datetime] NOT NULL,
	[CreatedByContactId] [uniqueidentifier] NOT NULL,
	[CreatedDate] [datetime] NOT NULL,
	[ChangedByContactId] [uniqueidentifier] NOT NULL,
	[ChangedDate] [datetime] NOT NULL,
	[AmountAssets] [float] NOT NULL,
	[IsGlobal] [bit] NOT NULL,
	[LockedBySid] [nvarchar](50) NULL,
PRIMARY KEY CLUSTERED 
(
	[PresetId] 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
/****** Object:  Table [dbo].[RecentProject]    Script Date: 11/16/2010 14:07:59 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [RecentProject](
	[RecentProjectId] [uniqueidentifier] NOT NULL,
	[ProjectId] [uniqueidentifier] NOT NULL,
	[UserSid] [nvarchar](50) NOT NULL,
	[CreateDate] [datetime] NOT NULL,
PRIMARY KEY CLUSTERED 
(
	[RecentProjectId] 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
/****** Object:  Table [dbo].[PresetPosition]    Script Date: 11/16/2010 14:07:59 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [PresetPosition](
	[PresetPositionId] [uniqueidentifier] NOT NULL,
	[PresetId] [uniqueidentifier] NOT NULL,
	[OrdinalPosition] [int] NOT NULL,
	[ConsecutiveNumber] [int] NOT NULL,
	[GroupId] [uniqueidentifier] NOT NULL,
	[ShortDescription] [nvarchar](255) NOT NULL,
	[LongDescription] [ntext] NULL,
	[Quantity] [float] NOT NULL,
	[Unit] [nvarchar](50) NOT NULL,
	[PricePerUnit] [float] NOT NULL,
	[IsBilled] [bit] NOT NULL,
	[IsBillable] [bit] NOT NULL,
	[CreatedByContactId] [uniqueidentifier] NOT NULL,
	[CreatedDate] [datetime] NOT NULL,
	[ChangedByContactId] [uniqueidentifier] NOT NULL,
	[ChangedDate] [datetime] NOT NULL,
	[SecondaryPricePerUnit] [float] NOT NULL,
	[ProvisionDate] [datetime] NULL,
	[LockedBySid] [nvarchar](50) NULL,
PRIMARY KEY CLUSTERED 
(
	[PresetPositionId] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[ProjectEmailRelation]    Script Date: 11/16/2010 14:07:59 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [ProjectEmailRelation](
	[ProjectEmailRelationId] [uniqueidentifier] NOT NULL,
	[Category] [nvarchar](255) NULL,
	[Subject] [ntext] NULL,
	[ProjectId] [uniqueidentifier] NOT NULL,
PRIMARY KEY CLUSTERED 
(
	[ProjectEmailRelationId] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[ProjectCustomExpand]    Script Date: 11/16/2010 14:07:59 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [ProjectCustomExpand](
	[ProjectCustomExpandId] [uniqueidentifier] NOT NULL,
PRIMARY KEY CLUSTERED 
(
	[ProjectCustomExpandId] 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
/****** Object:  Table [dbo].[ProjectContactRelation]    Script Date: 11/16/2010 14:07:59 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [ProjectContactRelation](
	[ProjectContactRelationId] [uniqueidentifier] NOT NULL,
	[ContactId] [uniqueidentifier] NOT NULL,
	[ProjectId] [uniqueidentifier] NOT NULL,
	[ContactType] [int] NOT NULL,
	[OrdinalPosition] [int] NOT NULL,
PRIMARY KEY CLUSTERED 
(
	[ProjectContactRelationId] 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
/****** Object:  Table [dbo].[ProjectCategoryRelation]    Script Date: 11/16/2010 14:07:59 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [ProjectCategoryRelation](
	[ProjectCategoryrelationId] [uniqueidentifier] NOT NULL,
	[CategoryId] [uniqueidentifier] NOT NULL,
	[ProjectId] [uniqueidentifier] NOT NULL,
PRIMARY KEY CLUSTERED 
(
	[ProjectCategoryrelationId] 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
/****** Object:  Table [dbo].[Budget]    Script Date: 11/16/2010 14:07:59 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [Budget](
	[BudgetId] [uniqueidentifier] NOT NULL,
	[ProjectId] [uniqueidentifier] NOT NULL,
	[BudgetType] [int] NOT NULL,
	[BudgetStateId] [uniqueidentifier] NOT NULL,
	[ConsecutiveNumber] [int] NOT NULL,
	[Name] [nvarchar](255) NOT NULL,
	[BudgetDate] [datetime] NOT NULL,
	[BudgetContactId] [uniqueidentifier] NULL,
	[CreatedByContactId] [uniqueidentifier] NOT NULL,
	[CreatedDate] [datetime] NOT NULL,
	[ChangedByContactId] [uniqueidentifier] NOT NULL,
	[ChangedDate] [datetime] NOT NULL,
	[AmountAssets] [float] NOT NULL,
	[LockedBySid] [nvarchar](50) NULL,
PRIMARY KEY CLUSTERED 
(
	[BudgetId] 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
/****** Object:  Table [dbo].[MindMap]    Script Date: 11/16/2010 14:07:59 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [MindMap](
	[MindMapId] [uniqueidentifier] NOT NULL,
	[ProjectId] [uniqueidentifier] NOT NULL,
	[Name] [nvarchar](250) NULL,
	[OrdinalPosition] [int] NOT NULL,
	[CreatedByName] [nvarchar](100) NULL,
	[CreatedDateTime] [datetime] NULL,
	[LastChangedByName] [nvarchar](100) NULL,
	[LastChangedDateTime] [datetime] NULL,
	[LockedBySid] [nvarchar](50) NULL,
PRIMARY KEY CLUSTERED 
(
	[MindMapId] 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
/****** Object:  Table [dbo].[DivisionGroupRelation]    Script Date: 11/16/2010 14:07:59 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [DivisionGroupRelation](
	[DivisionGroupRelationId] [uniqueidentifier] NOT NULL,
	[DivisionWorkingTimeId] [uniqueidentifier] NOT NULL,
	[GroupId] [uniqueidentifier] NOT NULL,
	[GroupName] [nvarchar](50) NOT NULL,
	[Percentage] [int] NOT NULL,
PRIMARY KEY CLUSTERED 
(
	[DivisionGroupRelationId] 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
/****** Object:  Table [dbo].[BudgetPosition]    Script Date: 11/16/2010 14:07:59 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [BudgetPosition](
	[BudgetPositionId] [uniqueidentifier] NOT NULL,
	[BudgetId] [uniqueidentifier] NOT NULL,
	[OrdinalPosition] [int] NOT NULL,
	[ConsecutiveNumber] [int] NOT NULL,
	[GroupId] [uniqueidentifier] NOT NULL,
	[ShortDescription] [nvarchar](255) NOT NULL,
	[LongDescription] [ntext] NULL,
	[Quantity] [float] NOT NULL,
	[Unit] [nvarchar](50) NOT NULL,
	[PricePerUnit] [float] NOT NULL,
	[IsBilled] [bit] NOT NULL,
	[IsBillable] [bit] NOT NULL,
	[CreatedByContactId] [uniqueidentifier] NOT NULL,
	[CreatedDate] [datetime] NOT NULL,
	[ChangedByContactId] [uniqueidentifier] NOT NULL,
	[ChangedDate] [datetime] NOT NULL,
	[SecondaryPricePerUnit] [float] NOT NULL,
	[ProvisionDate] [datetime] NULL,
	[LockedBySid] [nvarchar](50) NULL,
PRIMARY KEY CLUSTERED 
(
	[BudgetPositionId] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[BudgetCustomExpand]    Script Date: 11/16/2010 14:07:59 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [BudgetCustomExpand](
	[BudgetCustomExpandId] [uniqueidentifier] NOT NULL,
PRIMARY KEY CLUSTERED 
(
	[BudgetCustomExpandId] 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
/****** Object:  Table [dbo].[MindMapNode]    Script Date: 11/16/2010 14:07:59 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [MindMapNode](
	[MindMapNodeId] [uniqueidentifier] NOT NULL,
	[ParentNodeId] [uniqueidentifier] NULL,
	[MindMapId] [uniqueidentifier] NOT NULL,
	[Description] [ntext] NULL,
	[LongDescription] [ntext] NULL,
	[OrdinalPosition] [int] NOT NULL,
	[LocationX] [int] NOT NULL,
	[LocationY] [int] NOT NULL,
	[FontType] [nvarchar](50) NOT NULL,
	[FontSize] [float] NOT NULL,
	[IsBold] [bit] NOT NULL,
	[IsItalic] [bit] NOT NULL,
	[IsUnderline] [bit] NOT NULL,
	[FontColor] [int] NULL,
	[NodeColor] [int] NULL,
	[FrameColor] [int] NULL,
	[IsCollapsed] [bit] NOT NULL,
	[Progress] [int] NOT NULL,
	[ColorFlag] [int] NULL,
	[Image] [image] NULL,
	[CreatedByName] [nvarchar](100) NULL,
	[CreatedDateTime] [datetime] NULL,
	[LastChangedByName] [nvarchar](100) NULL,
	[LastChangedDateTime] [datetime] NULL,
	[LockedBySid] [nvarchar](50) NULL,
PRIMARY KEY CLUSTERED 
(
	[MindMapNodeId] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[MindMapCustomExpand]    Script Date: 11/16/2010 14:07:59 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [MindMapCustomExpand](
	[MindMapCustomExpandId] [uniqueidentifier] NOT NULL,
PRIMARY KEY CLUSTERED 
(
	[MindMapCustomExpandId] 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
/****** Object:  Table [dbo].[BudgetPositionCustomExpand]    Script Date: 11/16/2010 14:07:59 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [BudgetPositionCustomExpand](
	[BudgetPositionCustomExpandId] [uniqueidentifier] NOT NULL,
PRIMARY KEY CLUSTERED 
(
	[BudgetPositionCustomExpandId] 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
/****** Object:  Table [dbo].[MindMapNodeLink]    Script Date: 11/16/2010 14:07:59 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [MindMapNodeLink](
	[MindMapNodeLinkId] [uniqueidentifier] NOT NULL,
	[MindMapNodeId] [uniqueidentifier] NOT NULL,
	[StoragePath] [ntext] NOT NULL,
	[LinkType] [int] NOT NULL,
	[LockedBySid] [nvarchar](50) NULL,
PRIMARY KEY CLUSTERED 
(
	[MindMapNodeLinkId] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[MindMapNodeCustomExpand]    Script Date: 11/16/2010 14:07:59 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [MindMapNodeCustomExpand](
	[MindMapNodeCustomExpandId] [uniqueidentifier] NOT NULL,
PRIMARY KEY CLUSTERED 
(
	[MindMapNodeCustomExpandId] 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
/****** Object:  Table [dbo].[MindMapNodeContact]    Script Date: 11/16/2010 14:07:59 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [MindMapNodeContact](
	[MindMapNodeContactId] [uniqueidentifier] NOT NULL,
	[MindMapNodeId] [uniqueidentifier] NOT NULL,
	[ContactId] [uniqueidentifier] NOT NULL,
	[OrdinalPosition] [int] NOT NULL,
	[LockedBySid] [nvarchar](50) NULL,
PRIMARY KEY CLUSTERED 
(
	[MindMapNodeContactId] 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
/****** Object:  Table [dbo].[Planning]    Script Date: 11/16/2010 14:07:59 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [Planning](
	[PlanningId] [uniqueidentifier] NOT NULL,
	[ProjectId] [uniqueidentifier] NOT NULL,
	[DisplayName] [nvarchar](255) NOT NULL,
	[ParentPlanningId] [uniqueidentifier] NULL,
	[PositionNumber] [int] NOT NULL,
	[GroupId] [uniqueidentifier] NULL,
	[MindMapNodeId] [uniqueidentifier] NULL,
	[PlanningTypeId] [uniqueidentifier] NULL,
	[Location] [nvarchar](255) NULL,
	[PSPCode] [nvarchar](50) NULL,
	[ColorFlag] [int] NULL,
	[Progress] [int] NULL,
	[StartDateTime] [datetime] NOT NULL,
	[EndDateTime] [datetime] NOT NULL,
	[IsFixed] [bit] NULL,
	[Description] [ntext] NULL,
	[IsMilestone] [bit] NOT NULL,
	[IsGrouping] [bit] NOT NULL,
	[DoneDate] [datetime] NULL,
	[IsCollapsed] [bit] NOT NULL,
	[IsCritical] [bit] NOT NULL,
	[LockedBySid] [nvarchar](50) NULL,
PRIMARY KEY CLUSTERED 
(
	[PlanningId] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[PlanningReservation]    Script Date: 11/16/2010 14:07:59 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [PlanningReservation](
	[PlanningReservationId] [uniqueidentifier] NOT NULL,
	[ContactId] [uniqueidentifier] NOT NULL,
	[PlanningId] [uniqueidentifier] NOT NULL,
	[NotificationType] [int] NOT NULL,
	[WorkAmount] [float] NOT NULL,
	[IsDone] [bit] NULL,
	[Description] [ntext] NULL,
	[CostPerHour] [float] NULL,
	[LockedBySid] [nvarchar](50) NULL,
PRIMARY KEY CLUSTERED 
(
	[PlanningReservationId] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[PlanningLink]    Script Date: 11/16/2010 14:07:59 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [PlanningLink](
	[PlanningLinkId] [uniqueidentifier] NOT NULL,
	[PlanningId] [uniqueidentifier] NOT NULL,
	[StoragePath] [ntext] NOT NULL,
	[LinkType] [int] NOT NULL,
	[LockedBySid] [nvarchar](50) NULL,
PRIMARY KEY CLUSTERED 
(
	[PlanningLinkId] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[PlanningCustomExpand]    Script Date: 11/16/2010 14:07:59 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [PlanningCustomExpand](
	[PlanningCustomExpandId] [uniqueidentifier] NOT NULL,
PRIMARY KEY CLUSTERED 
(
	[PlanningCustomExpandId] 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
/****** Object:  Table [dbo].[PlanningConstraintRelation]    Script Date: 11/16/2010 14:07:59 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [PlanningConstraintRelation](
	[PlanningConstraintRelationId] [uniqueidentifier] NOT NULL,
	[ToPlanningId] [uniqueidentifier] NOT NULL,
	[FromPlanningId] [uniqueidentifier] NOT NULL,
	[LockedBySid] [nvarchar](50) NULL,
PRIMARY KEY CLUSTERED 
(
	[PlanningConstraintRelationId] 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
/****** Object:  Table [dbo].[OutlookElement]    Script Date: 11/16/2010 14:07:59 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [OutlookElement](
	[ElementId] [uniqueidentifier] NOT NULL,
	[EntryId] [nvarchar](1000) NOT NULL,
	[StoreId] [nvarchar](1000) NOT NULL,
	[PlanningId] [uniqueidentifier] NOT NULL,
	[ContactId] [uniqueidentifier] NOT NULL,
	[NotificationType] [int] NOT NULL,
	[IsLinked] [bit] NOT NULL,
PRIMARY KEY CLUSTERED 
(
	[ElementId] 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
/****** Object:  Table [dbo].[Action]    Script Date: 11/16/2010 14:07:59 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [Action](
	[ActionId] [uniqueidentifier] NOT NULL,
	[ProjectId] [uniqueidentifier] NOT NULL,
	[StartDateTime] [datetime] NOT NULL,
	[EndDateTime] [datetime] NOT NULL,
	[ColorFlag] [int] NULL,
	[Description] [ntext] NULL,
	[GroupId] [uniqueidentifier] NOT NULL,
	[PhaseId] [uniqueidentifier] NULL,
	[PerformedByContactId] [uniqueidentifier] NOT NULL,
	[ChangedByContactId] [uniqueidentifier] NOT NULL,
	[CreatedByContactId] [uniqueidentifier] NOT NULL,
	[CreatedDate] [datetime] NOT NULL,
	[ChangedDate] [datetime] NOT NULL,
	[HasDocuments] [bit] NULL,
	[BudgetDescription] [nvarchar](255) NOT NULL,
	[OrdinalPosition] [int] NOT NULL,
	[ConsecutiveNumber] [int] NOT NULL,
	[PricePerUnit] [float] NOT NULL,
	[IsBilled] [bit] NOT NULL,
	[IsBillable] [bit] NOT NULL,
	[SecondaryPricePerUnit] [float] NOT NULL,
	[ProvisionDate] [datetime] NULL,
	[LockedBySid] [nvarchar](50) NULL,
PRIMARY KEY CLUSTERED 
(
	[ActionId] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[CostUnitExport]    Script Date: 11/16/2010 14:07:59 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [CostUnitExport](
	[CostUnitExportId] [uniqueidentifier] NOT NULL,
	[ActionId] [uniqueidentifier] NOT NULL,
	[ProjectId] [uniqueidentifier] NOT NULL,
	[StartDateTime] [datetime] NOT NULL,
	[EndDateTime] [datetime] NOT NULL,
	[ColorFlag] [int] NULL,
	[Description] [ntext] NULL,
	[GroupId] [uniqueidentifier] NOT NULL,
	[PhaseId] [uniqueidentifier] NULL,
	[PerformedByContactId] [uniqueidentifier] NOT NULL,
	[ChangedByContactId] [uniqueidentifier] NOT NULL,
	[CreatedByContactId] [uniqueidentifier] NOT NULL,
	[CreatedDate] [datetime] NOT NULL,
	[ChangedDate] [datetime] NOT NULL,
	[HasDocuments] [bit] NULL,
	[BudgetDescription] [nvarchar](255) NOT NULL,
	[OrdinalPosition] [int] NOT NULL,
	[ConsecutiveNumber] [int] NOT NULL,
	[PricePerUnit] [float] NOT NULL,
	[IsBilled] [bit] NOT NULL,
	[IsBillable] [bit] NOT NULL,
	[SecondaryPricePerUnit] [float] NOT NULL,
	[ProvisionDate] [datetime] NULL,
	[LockedBySid] [nvarchar](50) NULL,
	[ExportDate] [datetime] NULL,
	[SequentialNumber] [int] NOT NULL,
PRIMARY KEY CLUSTERED 
(
	[CostUnitExportId] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[ActionCustomExpand]    Script Date: 11/16/2010 14:07:59 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [ActionCustomExpand](
	[ActionCustomExpandId] [uniqueidentifier] NOT NULL,
PRIMARY KEY CLUSTERED 
(
	[ActionCustomExpandId] 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
/****** Object:  Table [dbo].[ActionCostUnitRelation]    Script Date: 11/16/2010 14:07:59 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [ActionCostUnitRelation](
	[ActionCostUnitRelationId] [uniqueidentifier] NOT NULL,
	[ActionId] [uniqueidentifier] NOT NULL,
	[CostUnitId] [uniqueidentifier] NOT NULL,
PRIMARY KEY CLUSTERED 
(
	[ActionCostUnitRelationId] 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
/****** Object:  Table [dbo].[Document]    Script Date: 11/16/2010 14:07:59 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [Document](
	[DocumentId] [uniqueidentifier] NOT NULL,
	[ProjectId] [uniqueidentifier] NOT NULL,
	[Path] [nvarchar](1000) NULL,
	[State] [nvarchar](255) NULL,
	[Note] [ntext] NULL,
	[FileSize] [bigint] NULL,
	[FileType] [nvarchar](255) NOT NULL,
	[CreatedByContactId] [uniqueidentifier] NOT NULL,
	[CreatedDate] [datetime] NOT NULL,
	[ChangedByContactId] [uniqueidentifier] NOT NULL,
	[ChangedDate] [datetime] NOT NULL,
	[ActionId] [uniqueidentifier] NULL,
	[IsStandardFile] [bit] NULL,
	[IsInternetLink] [bit] NULL,
	[IsSPSDocument] [bit] NULL,
	[SPSSite] [nvarchar](255) NULL,
	[SPSDocumentLibrary] [nvarchar](255) NULL,
	[SPSSubfolders] [nvarchar](255) NULL,
	[SPSAuthor] [nvarchar](255) NULL,
	[SPSEditor] [nvarchar](255) NULL,
	[OutlookSender] [nvarchar](255) NULL,
	[OutlookSubject] [nvarchar](255) NULL,
	[OutlookReceivedDate] [datetime] NULL,
	[LockedBySid] [nvarchar](50) NULL,
PRIMARY KEY CLUSTERED 
(
	[DocumentId] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[DocumentCustomExpand]    Script Date: 11/16/2010 14:07:59 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [DocumentCustomExpand](
	[DocumentCustomExpandId] [uniqueidentifier] NOT NULL,
PRIMARY KEY CLUSTERED 
(
	[DocumentCustomExpandId] 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
/****** Object:  ForeignKey [FK_Action_Contact]    Script Date: 11/16/2010 14:07:59 ******/
ALTER TABLE [Action]  WITH CHECK ADD  CONSTRAINT [FK_Action_Contact] FOREIGN KEY([PerformedByContactId])
REFERENCES [Contact] ([ContactId])
GO
ALTER TABLE [Action] CHECK CONSTRAINT [FK_Action_Contact]
GO
/****** Object:  ForeignKey [FK_Action_Contact1]    Script Date: 11/16/2010 14:07:59 ******/
ALTER TABLE [Action]  WITH CHECK ADD  CONSTRAINT [FK_Action_Contact1] FOREIGN KEY([ChangedByContactId])
REFERENCES [Contact] ([ContactId])
GO
ALTER TABLE [Action] CHECK CONSTRAINT [FK_Action_Contact1]
GO
/****** Object:  ForeignKey [FK_Action_Contact2]    Script Date: 11/16/2010 14:07:59 ******/
ALTER TABLE [Action]  WITH CHECK ADD  CONSTRAINT [FK_Action_Contact2] FOREIGN KEY([CreatedByContactId])
REFERENCES [Contact] ([ContactId])
GO
ALTER TABLE [Action] CHECK CONSTRAINT [FK_Action_Contact2]
GO
/****** Object:  ForeignKey [FK_Action_Group]    Script Date: 11/16/2010 14:07:59 ******/
ALTER TABLE [Action]  WITH CHECK ADD  CONSTRAINT [FK_Action_Group] FOREIGN KEY([GroupId])
REFERENCES [Group] ([GroupId])
GO
ALTER TABLE [Action] CHECK CONSTRAINT [FK_Action_Group]
GO
/****** Object:  ForeignKey [FK_Action_Planning]    Script Date: 11/16/2010 14:07:59 ******/
ALTER TABLE [Action]  WITH CHECK ADD  CONSTRAINT [FK_Action_Planning] FOREIGN KEY([PhaseId])
REFERENCES [Planning] ([PlanningId])
GO
ALTER TABLE [Action] CHECK CONSTRAINT [FK_Action_Planning]
GO
/****** Object:  ForeignKey [FK_Action_Project]    Script Date: 11/16/2010 14:07:59 ******/
ALTER TABLE [Action]  WITH CHECK ADD  CONSTRAINT [FK_Action_Project] FOREIGN KEY([ProjectId])
REFERENCES [Project] ([ProjectId])
GO
ALTER TABLE [Action] CHECK CONSTRAINT [FK_Action_Project]
GO
/****** Object:  ForeignKey [FK_ActionCostUnitRelation_Action]    Script Date: 11/16/2010 14:07:59 ******/
ALTER TABLE [ActionCostUnitRelation]  WITH CHECK ADD  CONSTRAINT [FK_ActionCostUnitRelation_Action] FOREIGN KEY([ActionId])
REFERENCES [Action] ([ActionId])
GO
ALTER TABLE [ActionCostUnitRelation] CHECK CONSTRAINT [FK_ActionCostUnitRelation_Action]
GO
/****** Object:  ForeignKey [FK_ActionCostUnitRelation_CostUnit]    Script Date: 11/16/2010 14:07:59 ******/
ALTER TABLE [ActionCostUnitRelation]  WITH CHECK ADD  CONSTRAINT [FK_ActionCostUnitRelation_CostUnit] FOREIGN KEY([CostUnitId])
REFERENCES [CostUnit] ([CostUnitId])
GO
ALTER TABLE [ActionCostUnitRelation] CHECK CONSTRAINT [FK_ActionCostUnitRelation_CostUnit]
GO
/****** Object:  ForeignKey [FK_ActionCustomExpand_Action]    Script Date: 11/16/2010 14:07:59 ******/
ALTER TABLE [ActionCustomExpand]  WITH CHECK ADD  CONSTRAINT [FK_ActionCustomExpand_Action] FOREIGN KEY([ActionCustomExpandId])
REFERENCES [Action] ([ActionId])
GO
ALTER TABLE [ActionCustomExpand] CHECK CONSTRAINT [FK_ActionCustomExpand_Action]
GO
/****** Object:  ForeignKey [FK_Budget_BudgetState]    Script Date: 11/16/2010 14:07:59 ******/
ALTER TABLE [Budget]  WITH CHECK ADD  CONSTRAINT [FK_Budget_BudgetState] FOREIGN KEY([BudgetStateId])
REFERENCES [BudgetState] ([BudgetStateId])
GO
ALTER TABLE [Budget] CHECK CONSTRAINT [FK_Budget_BudgetState]
GO
/****** Object:  ForeignKey [FK_Budget_Contact]    Script Date: 11/16/2010 14:07:59 ******/
ALTER TABLE [Budget]  WITH CHECK ADD  CONSTRAINT [FK_Budget_Contact] FOREIGN KEY([ChangedByContactId])
REFERENCES [Contact] ([ContactId])
GO
ALTER TABLE [Budget] CHECK CONSTRAINT [FK_Budget_Contact]
GO
/****** Object:  ForeignKey [FK_Budget_Contact1]    Script Date: 11/16/2010 14:07:59 ******/
ALTER TABLE [Budget]  WITH CHECK ADD  CONSTRAINT [FK_Budget_Contact1] FOREIGN KEY([BudgetContactId])
REFERENCES [Contact] ([ContactId])
GO
ALTER TABLE [Budget] CHECK CONSTRAINT [FK_Budget_Contact1]
GO
/****** Object:  ForeignKey [FK_Budget_Contact2]    Script Date: 11/16/2010 14:07:59 ******/
ALTER TABLE [Budget]  WITH CHECK ADD  CONSTRAINT [FK_Budget_Contact2] FOREIGN KEY([CreatedByContactId])
REFERENCES [Contact] ([ContactId])
GO
ALTER TABLE [Budget] CHECK CONSTRAINT [FK_Budget_Contact2]
GO
/****** Object:  ForeignKey [FK_Budget_Project]    Script Date: 11/16/2010 14:07:59 ******/
ALTER TABLE [Budget]  WITH CHECK ADD  CONSTRAINT [FK_Budget_Project] FOREIGN KEY([ProjectId])
REFERENCES [Project] ([ProjectId])
GO
ALTER TABLE [Budget] CHECK CONSTRAINT [FK_Budget_Project]
GO
/****** Object:  ForeignKey [FK_BudgetCustomExpand_Budget]    Script Date: 11/16/2010 14:07:59 ******/
ALTER TABLE [BudgetCustomExpand]  WITH CHECK ADD  CONSTRAINT [FK_BudgetCustomExpand_Budget] FOREIGN KEY([BudgetCustomExpandId])
REFERENCES [Budget] ([BudgetId])
GO
ALTER TABLE [BudgetCustomExpand] CHECK CONSTRAINT [FK_BudgetCustomExpand_Budget]
GO
/****** Object:  ForeignKey [FK_BudgetPosition_Budget]    Script Date: 11/16/2010 14:07:59 ******/
ALTER TABLE [BudgetPosition]  WITH CHECK ADD  CONSTRAINT [FK_BudgetPosition_Budget] FOREIGN KEY([BudgetId])
REFERENCES [Budget] ([BudgetId])
GO
ALTER TABLE [BudgetPosition] CHECK CONSTRAINT [FK_BudgetPosition_Budget]
GO
/****** Object:  ForeignKey [FK_BudgetPosition_Contact]    Script Date: 11/16/2010 14:07:59 ******/
ALTER TABLE [BudgetPosition]  WITH CHECK ADD  CONSTRAINT [FK_BudgetPosition_Contact] FOREIGN KEY([ChangedByContactId])
REFERENCES [Contact] ([ContactId])
GO
ALTER TABLE [BudgetPosition] CHECK CONSTRAINT [FK_BudgetPosition_Contact]
GO
/****** Object:  ForeignKey [FK_BudgetPosition_Contact1]    Script Date: 11/16/2010 14:07:59 ******/
ALTER TABLE [BudgetPosition]  WITH CHECK ADD  CONSTRAINT [FK_BudgetPosition_Contact1] FOREIGN KEY([CreatedByContactId])
REFERENCES [Contact] ([ContactId])
GO
ALTER TABLE [BudgetPosition] CHECK CONSTRAINT [FK_BudgetPosition_Contact1]
GO
/****** Object:  ForeignKey [FK_BudgetPosition_Group]    Script Date: 11/16/2010 14:07:59 ******/
ALTER TABLE [BudgetPosition]  WITH CHECK ADD  CONSTRAINT [FK_BudgetPosition_Group] FOREIGN KEY([GroupId])
REFERENCES [Group] ([GroupId])
GO
ALTER TABLE [BudgetPosition] CHECK CONSTRAINT [FK_BudgetPosition_Group]
GO
/****** Object:  ForeignKey [FK_BudgetPositionCustomExpand_BudgetPosition]    Script Date: 11/16/2010 14:07:59 ******/
ALTER TABLE [BudgetPositionCustomExpand]  WITH CHECK ADD  CONSTRAINT [FK_BudgetPositionCustomExpand_BudgetPosition] FOREIGN KEY([BudgetPositionCustomExpandId])
REFERENCES [BudgetPosition] ([BudgetPositionId])
GO
ALTER TABLE [BudgetPositionCustomExpand] CHECK CONSTRAINT [FK_BudgetPositionCustomExpand_BudgetPosition]
GO
/****** Object:  ForeignKey [FK_BudgetPositionTemplateGroup_BudgetPositionTemplate]    Script Date: 11/16/2010 14:07:59 ******/
ALTER TABLE [BudgetPositionTemplateGroup]  WITH CHECK ADD  CONSTRAINT [FK_BudgetPositionTemplateGroup_BudgetPositionTemplate] FOREIGN KEY([BudgetPositionTemplateId])
REFERENCES [BudgetPositionTemplate] ([BudgetPositionTemplateId])
GO
ALTER TABLE [BudgetPositionTemplateGroup] CHECK CONSTRAINT [FK_BudgetPositionTemplateGroup_BudgetPositionTemplate]
GO
/****** Object:  ForeignKey [FK_BudgetPositionTemplateGroup_Group]    Script Date: 11/16/2010 14:07:59 ******/
ALTER TABLE [BudgetPositionTemplateGroup]  WITH CHECK ADD  CONSTRAINT [FK_BudgetPositionTemplateGroup_Group] FOREIGN KEY([GroupId])
REFERENCES [Group] ([GroupId])
GO
ALTER TABLE [BudgetPositionTemplateGroup] CHECK CONSTRAINT [FK_BudgetPositionTemplateGroup_Group]
GO
/****** Object:  ForeignKey [FK_BudgetPositionTemplatePrice_BudgetPositionTemplate]    Script Date: 11/16/2010 14:07:59 ******/
ALTER TABLE [BudgetPositionTemplatePrice]  WITH CHECK ADD  CONSTRAINT [FK_BudgetPositionTemplatePrice_BudgetPositionTemplate] FOREIGN KEY([BudgetPositionTemplateId])
REFERENCES [BudgetPositionTemplate] ([BudgetPositionTemplateId])
GO
ALTER TABLE [BudgetPositionTemplatePrice] CHECK CONSTRAINT [FK_BudgetPositionTemplatePrice_BudgetPositionTemplate]
GO
/****** Object:  ForeignKey [FK_CostUnitExport_Action]    Script Date: 11/16/2010 14:07:59 ******/
ALTER TABLE [CostUnitExport]  WITH CHECK ADD  CONSTRAINT [FK_CostUnitExport_Action] FOREIGN KEY([ActionId])
REFERENCES [Action] ([ActionId])
GO
ALTER TABLE [CostUnitExport] CHECK CONSTRAINT [FK_CostUnitExport_Action]
GO
/****** Object:  ForeignKey [FK_CostUnitExport_Contact]    Script Date: 11/16/2010 14:07:59 ******/
ALTER TABLE [CostUnitExport]  WITH CHECK ADD  CONSTRAINT [FK_CostUnitExport_Contact] FOREIGN KEY([CreatedByContactId])
REFERENCES [Contact] ([ContactId])
GO
ALTER TABLE [CostUnitExport] CHECK CONSTRAINT [FK_CostUnitExport_Contact]
GO
/****** Object:  ForeignKey [FK_CostUnitExport_Contact1]    Script Date: 11/16/2010 14:07:59 ******/
ALTER TABLE [CostUnitExport]  WITH CHECK ADD  CONSTRAINT [FK_CostUnitExport_Contact1] FOREIGN KEY([ChangedByContactId])
REFERENCES [Contact] ([ContactId])
GO
ALTER TABLE [CostUnitExport] CHECK CONSTRAINT [FK_CostUnitExport_Contact1]
GO
/****** Object:  ForeignKey [FK_CostUnitExport_Contact2]    Script Date: 11/16/2010 14:07:59 ******/
ALTER TABLE [CostUnitExport]  WITH CHECK ADD  CONSTRAINT [FK_CostUnitExport_Contact2] FOREIGN KEY([PerformedByContactId])
REFERENCES [Contact] ([ContactId])
GO
ALTER TABLE [CostUnitExport] CHECK CONSTRAINT [FK_CostUnitExport_Contact2]
GO
/****** Object:  ForeignKey [FK_CostUnitExport_Group]    Script Date: 11/16/2010 14:07:59 ******/
ALTER TABLE [CostUnitExport]  WITH CHECK ADD  CONSTRAINT [FK_CostUnitExport_Group] FOREIGN KEY([GroupId])
REFERENCES [Group] ([GroupId])
GO
ALTER TABLE [CostUnitExport] CHECK CONSTRAINT [FK_CostUnitExport_Group]
GO
/****** Object:  ForeignKey [FK_CostUnitExport_Planning]    Script Date: 11/16/2010 14:07:59 ******/
ALTER TABLE [CostUnitExport]  WITH CHECK ADD  CONSTRAINT [FK_CostUnitExport_Planning] FOREIGN KEY([PhaseId])
REFERENCES [Planning] ([PlanningId])
GO
ALTER TABLE [CostUnitExport] CHECK CONSTRAINT [FK_CostUnitExport_Planning]
GO
/****** Object:  ForeignKey [FK_CostUnitExport_Project]    Script Date: 11/16/2010 14:07:59 ******/
ALTER TABLE [CostUnitExport]  WITH CHECK ADD  CONSTRAINT [FK_CostUnitExport_Project] FOREIGN KEY([ProjectId])
REFERENCES [Project] ([ProjectId])
GO
ALTER TABLE [CostUnitExport] CHECK CONSTRAINT [FK_CostUnitExport_Project]
GO
/****** Object:  ForeignKey [FK_CostUnitRelation_Contact]    Script Date: 11/16/2010 14:07:59 ******/
ALTER TABLE [CostUnitRelation]  WITH CHECK ADD  CONSTRAINT [FK_CostUnitRelation_Contact] FOREIGN KEY([ContactId])
REFERENCES [Contact] ([ContactId])
GO
ALTER TABLE [CostUnitRelation] CHECK CONSTRAINT [FK_CostUnitRelation_Contact]
GO
/****** Object:  ForeignKey [FK_CostUnitRelation_CostUnit]    Script Date: 11/16/2010 14:07:59 ******/
ALTER TABLE [CostUnitRelation]  WITH CHECK ADD  CONSTRAINT [FK_CostUnitRelation_CostUnit] FOREIGN KEY([CostUnitId])
REFERENCES [CostUnit] ([CostUnitId])
GO
ALTER TABLE [CostUnitRelation] CHECK CONSTRAINT [FK_CostUnitRelation_CostUnit]
GO
/****** Object:  ForeignKey [FK_Division_Division]    Script Date: 11/16/2010 14:07:59 ******/
ALTER TABLE [Division]  WITH CHECK ADD  CONSTRAINT [FK_Division_Division] FOREIGN KEY([ParentDivisionId])
REFERENCES [Division] ([DivisionId])
GO
ALTER TABLE [Division] CHECK CONSTRAINT [FK_Division_Division]
GO
/****** Object:  ForeignKey [FK_DivisionContactRelation_Contact]    Script Date: 11/16/2010 14:07:59 ******/
ALTER TABLE [DivisionContactRelation]  WITH CHECK ADD  CONSTRAINT [FK_DivisionContactRelation_Contact] FOREIGN KEY([ContactId])
REFERENCES [Contact] ([ContactId])
GO
ALTER TABLE [DivisionContactRelation] CHECK CONSTRAINT [FK_DivisionContactRelation_Contact]
GO
/****** Object:  ForeignKey [FK_DivisionContactRelation_Division]    Script Date: 11/16/2010 14:07:59 ******/
ALTER TABLE [DivisionContactRelation]  WITH CHECK ADD  CONSTRAINT [FK_DivisionContactRelation_Division] FOREIGN KEY([DivisionId])
REFERENCES [Division] ([DivisionId])
GO
ALTER TABLE [DivisionContactRelation] CHECK CONSTRAINT [FK_DivisionContactRelation_Division]
GO
/****** Object:  ForeignKey [FK_DivisionGroupRelation_DivisionWorkingTime]    Script Date: 11/16/2010 14:07:59 ******/
ALTER TABLE [DivisionGroupRelation]  WITH CHECK ADD  CONSTRAINT [FK_DivisionGroupRelation_DivisionWorkingTime] FOREIGN KEY([DivisionWorkingTimeId])
REFERENCES [DivisionWorkingTime] ([DivisionWorkingTimeId])
GO
ALTER TABLE [DivisionGroupRelation] CHECK CONSTRAINT [FK_DivisionGroupRelation_DivisionWorkingTime]
GO
/****** Object:  ForeignKey [FK_DivisionGroupRelation_Group]    Script Date: 11/16/2010 14:07:59 ******/
ALTER TABLE [DivisionGroupRelation]  WITH CHECK ADD  CONSTRAINT [FK_DivisionGroupRelation_Group] FOREIGN KEY([GroupId])
REFERENCES [Group] ([GroupId])
GO
ALTER TABLE [DivisionGroupRelation] CHECK CONSTRAINT [FK_DivisionGroupRelation_Group]
GO
/****** Object:  ForeignKey [FK_DivisionWorkingTime_Division]    Script Date: 11/16/2010 14:07:59 ******/
ALTER TABLE [DivisionWorkingTime]  WITH CHECK ADD  CONSTRAINT [FK_DivisionWorkingTime_Division] FOREIGN KEY([DivisionId])
REFERENCES [Division] ([DivisionId])
GO
ALTER TABLE [DivisionWorkingTime] CHECK CONSTRAINT [FK_DivisionWorkingTime_Division]
GO
/****** Object:  ForeignKey [FK_Document_Action]    Script Date: 11/16/2010 14:07:59 ******/
ALTER TABLE [Document]  WITH CHECK ADD  CONSTRAINT [FK_Document_Action] FOREIGN KEY([ActionId])
REFERENCES [Action] ([ActionId])
GO
ALTER TABLE [Document] CHECK CONSTRAINT [FK_Document_Action]
GO
/****** Object:  ForeignKey [FK_Document_Contact]    Script Date: 11/16/2010 14:07:59 ******/
ALTER TABLE [Document]  WITH CHECK ADD  CONSTRAINT [FK_Document_Contact] FOREIGN KEY([CreatedByContactId])
REFERENCES [Contact] ([ContactId])
GO
ALTER TABLE [Document] CHECK CONSTRAINT [FK_Document_Contact]
GO
/****** Object:  ForeignKey [FK_Document_Contact1]    Script Date: 11/16/2010 14:07:59 ******/
ALTER TABLE [Document]  WITH CHECK ADD  CONSTRAINT [FK_Document_Contact1] FOREIGN KEY([ChangedByContactId])
REFERENCES [Contact] ([ContactId])
GO
ALTER TABLE [Document] CHECK CONSTRAINT [FK_Document_Contact1]
GO
/****** Object:  ForeignKey [FK_Document_Project]    Script Date: 11/16/2010 14:07:59 ******/
ALTER TABLE [Document]  WITH CHECK ADD  CONSTRAINT [FK_Document_Project] FOREIGN KEY([ProjectId])
REFERENCES [Project] ([ProjectId])
GO
ALTER TABLE [Document] CHECK CONSTRAINT [FK_Document_Project]
GO
/****** Object:  ForeignKey [FK_DocumentCustomExpand_Document]    Script Date: 11/16/2010 14:07:59 ******/
ALTER TABLE [DocumentCustomExpand]  WITH CHECK ADD  CONSTRAINT [FK_DocumentCustomExpand_Document] FOREIGN KEY([DocumentCustomExpandId])
REFERENCES [Document] ([DocumentId])
GO
ALTER TABLE [DocumentCustomExpand] CHECK CONSTRAINT [FK_DocumentCustomExpand_Document]
GO
/****** Object:  ForeignKey [FK_MindMap_Project]    Script Date: 11/16/2010 14:07:59 ******/
ALTER TABLE [MindMap]  WITH CHECK ADD  CONSTRAINT [FK_MindMap_Project] FOREIGN KEY([ProjectId])
REFERENCES [Project] ([ProjectId])
GO
ALTER TABLE [MindMap] CHECK CONSTRAINT [FK_MindMap_Project]
GO
/****** Object:  ForeignKey [FK_MindMapCustomExpand_MindMap]    Script Date: 11/16/2010 14:07:59 ******/
ALTER TABLE [MindMapCustomExpand]  WITH CHECK ADD  CONSTRAINT [FK_MindMapCustomExpand_MindMap] FOREIGN KEY([MindMapCustomExpandId])
REFERENCES [MindMap] ([MindMapId])
GO
ALTER TABLE [MindMapCustomExpand] CHECK CONSTRAINT [FK_MindMapCustomExpand_MindMap]
GO
/****** Object:  ForeignKey [FK_MindMapNode_MindMap]    Script Date: 11/16/2010 14:07:59 ******/
ALTER TABLE [MindMapNode]  WITH CHECK ADD  CONSTRAINT [FK_MindMapNode_MindMap] FOREIGN KEY([MindMapId])
REFERENCES [MindMap] ([MindMapId])
GO
ALTER TABLE [MindMapNode] CHECK CONSTRAINT [FK_MindMapNode_MindMap]
GO
/****** Object:  ForeignKey [FK_MindMapNode_MindMapNode]    Script Date: 11/16/2010 14:07:59 ******/
ALTER TABLE [MindMapNode]  WITH CHECK ADD  CONSTRAINT [FK_MindMapNode_MindMapNode] FOREIGN KEY([ParentNodeId])
REFERENCES [MindMapNode] ([MindMapNodeId])
GO
ALTER TABLE [MindMapNode] CHECK CONSTRAINT [FK_MindMapNode_MindMapNode]
GO
/****** Object:  ForeignKey [FK_MindMapNodeContact_Contact]    Script Date: 11/16/2010 14:07:59 ******/
ALTER TABLE [MindMapNodeContact]  WITH CHECK ADD  CONSTRAINT [FK_MindMapNodeContact_Contact] FOREIGN KEY([ContactId])
REFERENCES [Contact] ([ContactId])
GO
ALTER TABLE [MindMapNodeContact] CHECK CONSTRAINT [FK_MindMapNodeContact_Contact]
GO
/****** Object:  ForeignKey [FK_MindMapNodeContact_MindMapNode]    Script Date: 11/16/2010 14:07:59 ******/
ALTER TABLE [MindMapNodeContact]  WITH CHECK ADD  CONSTRAINT [FK_MindMapNodeContact_MindMapNode] FOREIGN KEY([MindMapNodeId])
REFERENCES [MindMapNode] ([MindMapNodeId])
GO
ALTER TABLE [MindMapNodeContact] CHECK CONSTRAINT [FK_MindMapNodeContact_MindMapNode]
GO
/****** Object:  ForeignKey [FK_MindMapNodeCustomExpand_MindMapNode]    Script Date: 11/16/2010 14:07:59 ******/
ALTER TABLE [MindMapNodeCustomExpand]  WITH CHECK ADD  CONSTRAINT [FK_MindMapNodeCustomExpand_MindMapNode] FOREIGN KEY([MindMapNodeCustomExpandId])
REFERENCES [MindMapNode] ([MindMapNodeId])
GO
ALTER TABLE [MindMapNodeCustomExpand] CHECK CONSTRAINT [FK_MindMapNodeCustomExpand_MindMapNode]
GO
/****** Object:  ForeignKey [FK_MindMapNodeLink_MindMapNode]    Script Date: 11/16/2010 14:07:59 ******/
ALTER TABLE [MindMapNodeLink]  WITH CHECK ADD  CONSTRAINT [FK_MindMapNodeLink_MindMapNode] FOREIGN KEY([MindMapNodeId])
REFERENCES [MindMapNode] ([MindMapNodeId])
GO
ALTER TABLE [MindMapNodeLink] CHECK CONSTRAINT [FK_MindMapNodeLink_MindMapNode]
GO
/****** Object:  ForeignKey [FK_OutlookElement_Contact]    Script Date: 11/16/2010 14:07:59 ******/
ALTER TABLE [OutlookElement]  WITH CHECK ADD  CONSTRAINT [FK_OutlookElement_Contact] FOREIGN KEY([ContactId])
REFERENCES [Contact] ([ContactId])
GO
ALTER TABLE [OutlookElement] CHECK CONSTRAINT [FK_OutlookElement_Contact]
GO
/****** Object:  ForeignKey [FK_OutlookElement_Planning]    Script Date: 11/16/2010 14:07:59 ******/
ALTER TABLE [OutlookElement]  WITH CHECK ADD  CONSTRAINT [FK_OutlookElement_Planning] FOREIGN KEY([PlanningId])
REFERENCES [Planning] ([PlanningId])
GO
ALTER TABLE [OutlookElement] CHECK CONSTRAINT [FK_OutlookElement_Planning]
GO
/****** Object:  ForeignKey [FK_Planning_Group]    Script Date: 11/16/2010 14:07:59 ******/
ALTER TABLE [Planning]  WITH CHECK ADD  CONSTRAINT [FK_Planning_Group] FOREIGN KEY([GroupId])
REFERENCES [Group] ([GroupId])
GO
ALTER TABLE [Planning] CHECK CONSTRAINT [FK_Planning_Group]
GO
/****** Object:  ForeignKey [FK_Planning_MindMapNode]    Script Date: 11/16/2010 14:07:59 ******/
ALTER TABLE [Planning]  WITH CHECK ADD  CONSTRAINT [FK_Planning_MindMapNode] FOREIGN KEY([MindMapNodeId])
REFERENCES [MindMapNode] ([MindMapNodeId])
GO
ALTER TABLE [Planning] CHECK CONSTRAINT [FK_Planning_MindMapNode]
GO
/****** Object:  ForeignKey [FK_Planning_Planning]    Script Date: 11/16/2010 14:07:59 ******/
ALTER TABLE [Planning]  WITH CHECK ADD  CONSTRAINT [FK_Planning_Planning] FOREIGN KEY([ParentPlanningId])
REFERENCES [Planning] ([PlanningId])
GO
ALTER TABLE [Planning] CHECK CONSTRAINT [FK_Planning_Planning]
GO
/****** Object:  ForeignKey [FK_Planning_Project]    Script Date: 11/16/2010 14:07:59 ******/
ALTER TABLE [Planning]  WITH CHECK ADD  CONSTRAINT [FK_Planning_Project] FOREIGN KEY([ProjectId])
REFERENCES [Project] ([ProjectId])
GO
ALTER TABLE [Planning] CHECK CONSTRAINT [FK_Planning_Project]
GO
/****** Object:  ForeignKey [FK_PlanningConstraintRelation_Planning]    Script Date: 11/16/2010 14:07:59 ******/
ALTER TABLE [PlanningConstraintRelation]  WITH CHECK ADD  CONSTRAINT [FK_PlanningConstraintRelation_Planning] FOREIGN KEY([FromPlanningId])
REFERENCES [Planning] ([PlanningId])
GO
ALTER TABLE [PlanningConstraintRelation] CHECK CONSTRAINT [FK_PlanningConstraintRelation_Planning]
GO
/****** Object:  ForeignKey [FK_PlanningConstraintRelation_Planning1]    Script Date: 11/16/2010 14:07:59 ******/
ALTER TABLE [PlanningConstraintRelation]  WITH CHECK ADD  CONSTRAINT [FK_PlanningConstraintRelation_Planning1] FOREIGN KEY([ToPlanningId])
REFERENCES [Planning] ([PlanningId])
GO
ALTER TABLE [PlanningConstraintRelation] CHECK CONSTRAINT [FK_PlanningConstraintRelation_Planning1]
GO
/****** Object:  ForeignKey [FK_PlanningCustomExpand_Planning]    Script Date: 11/16/2010 14:07:59 ******/
ALTER TABLE [PlanningCustomExpand]  WITH CHECK ADD  CONSTRAINT [FK_PlanningCustomExpand_Planning] FOREIGN KEY([PlanningCustomExpandId])
REFERENCES [Planning] ([PlanningId])
GO
ALTER TABLE [PlanningCustomExpand] CHECK CONSTRAINT [FK_PlanningCustomExpand_Planning]
GO
/****** Object:  ForeignKey [FK_PlanningLink_Planning]    Script Date: 11/16/2010 14:07:59 ******/
ALTER TABLE [PlanningLink]  WITH CHECK ADD  CONSTRAINT [FK_PlanningLink_Planning] FOREIGN KEY([PlanningId])
REFERENCES [Planning] ([PlanningId])
GO
ALTER TABLE [PlanningLink] CHECK CONSTRAINT [FK_PlanningLink_Planning]
GO
/****** Object:  ForeignKey [FK_PlanningReservation_Contact]    Script Date: 11/16/2010 14:07:59 ******/
ALTER TABLE [PlanningReservation]  WITH CHECK ADD  CONSTRAINT [FK_PlanningReservation_Contact] FOREIGN KEY([ContactId])
REFERENCES [Contact] ([ContactId])
GO
ALTER TABLE [PlanningReservation] CHECK CONSTRAINT [FK_PlanningReservation_Contact]
GO
/****** Object:  ForeignKey [FK_PlanningReservation_Planning]    Script Date: 11/16/2010 14:07:59 ******/
ALTER TABLE [PlanningReservation]  WITH CHECK ADD  CONSTRAINT [FK_PlanningReservation_Planning] FOREIGN KEY([PlanningId])
REFERENCES [Planning] ([PlanningId])
GO
ALTER TABLE [PlanningReservation] CHECK CONSTRAINT [FK_PlanningReservation_Planning]
GO
/****** Object:  ForeignKey [FK_Preset_Contact]    Script Date: 11/16/2010 14:07:59 ******/
ALTER TABLE [Preset]  WITH CHECK ADD  CONSTRAINT [FK_Preset_Contact] FOREIGN KEY([CreatedByContactId])
REFERENCES [Contact] ([ContactId])
GO
ALTER TABLE [Preset] CHECK CONSTRAINT [FK_Preset_Contact]
GO
/****** Object:  ForeignKey [FK_Preset_Contact1]    Script Date: 11/16/2010 14:07:59 ******/
ALTER TABLE [Preset]  WITH CHECK ADD  CONSTRAINT [FK_Preset_Contact1] FOREIGN KEY([ChangedByContactId])
REFERENCES [Contact] ([ContactId])
GO
ALTER TABLE [Preset] CHECK CONSTRAINT [FK_Preset_Contact1]
GO
/****** Object:  ForeignKey [FK_PresetPosition_Contact]    Script Date: 11/16/2010 14:07:59 ******/
ALTER TABLE [PresetPosition]  WITH CHECK ADD  CONSTRAINT [FK_PresetPosition_Contact] FOREIGN KEY([ChangedByContactId])
REFERENCES [Contact] ([ContactId])
GO
ALTER TABLE [PresetPosition] CHECK CONSTRAINT [FK_PresetPosition_Contact]
GO
/****** Object:  ForeignKey [FK_PresetPosition_Contact1]    Script Date: 11/16/2010 14:07:59 ******/
ALTER TABLE [PresetPosition]  WITH CHECK ADD  CONSTRAINT [FK_PresetPosition_Contact1] FOREIGN KEY([CreatedByContactId])
REFERENCES [Contact] ([ContactId])
GO
ALTER TABLE [PresetPosition] CHECK CONSTRAINT [FK_PresetPosition_Contact1]
GO
/****** Object:  ForeignKey [FK_PresetPosition_Group]    Script Date: 11/16/2010 14:07:59 ******/
ALTER TABLE [PresetPosition]  WITH CHECK ADD  CONSTRAINT [FK_PresetPosition_Group] FOREIGN KEY([GroupId])
REFERENCES [Group] ([GroupId])
GO
ALTER TABLE [PresetPosition] CHECK CONSTRAINT [FK_PresetPosition_Group]
GO
/****** Object:  ForeignKey [FK_PresetPosition_Preset]    Script Date: 11/16/2010 14:07:59 ******/
ALTER TABLE [PresetPosition]  WITH CHECK ADD  CONSTRAINT [FK_PresetPosition_Preset] FOREIGN KEY([PresetId])
REFERENCES [Preset] ([PresetId])
GO
ALTER TABLE [PresetPosition] CHECK CONSTRAINT [FK_PresetPosition_Preset]
GO
/****** Object:  ForeignKey [FK_Project_Client]    Script Date: 11/16/2010 14:07:59 ******/
ALTER TABLE [Project]  WITH CHECK ADD  CONSTRAINT [FK_Project_Client] FOREIGN KEY([ClientId])
REFERENCES [Client] ([ClientId])
GO
ALTER TABLE [Project] CHECK CONSTRAINT [FK_Project_Client]
GO
/****** Object:  ForeignKey [FK_Project_Division]    Script Date: 11/16/2010 14:07:59 ******/
ALTER TABLE [Project]  WITH CHECK ADD  CONSTRAINT [FK_Project_Division] FOREIGN KEY([DivisionId])
REFERENCES [Division] ([DivisionId])
GO
ALTER TABLE [Project] CHECK CONSTRAINT [FK_Project_Division]
GO
/****** Object:  ForeignKey [FK_Project_ProjectStatus]    Script Date: 11/16/2010 14:07:59 ******/
ALTER TABLE [Project]  WITH CHECK ADD  CONSTRAINT [FK_Project_ProjectStatus] FOREIGN KEY([ProjectStatusId])
REFERENCES [ProjectStatus] ([ProjectStatusId])
GO
ALTER TABLE [Project] CHECK CONSTRAINT [FK_Project_ProjectStatus]
GO
/****** Object:  ForeignKey [FK_ProjectCategoryRelation_Category]    Script Date: 11/16/2010 14:07:59 ******/
ALTER TABLE [ProjectCategoryRelation]  WITH CHECK ADD  CONSTRAINT [FK_ProjectCategoryRelation_Category] FOREIGN KEY([CategoryId])
REFERENCES [Category] ([CategoryId])
GO
ALTER TABLE [ProjectCategoryRelation] CHECK CONSTRAINT [FK_ProjectCategoryRelation_Category]
GO
/****** Object:  ForeignKey [FK_ProjectCategoryRelation_Project]    Script Date: 11/16/2010 14:07:59 ******/
ALTER TABLE [ProjectCategoryRelation]  WITH CHECK ADD  CONSTRAINT [FK_ProjectCategoryRelation_Project] FOREIGN KEY([ProjectId])
REFERENCES [Project] ([ProjectId])
GO
ALTER TABLE [ProjectCategoryRelation] CHECK CONSTRAINT [FK_ProjectCategoryRelation_Project]
GO
/****** Object:  ForeignKey [FK_ProjectContactRelation_Contact]    Script Date: 11/16/2010 14:07:59 ******/
ALTER TABLE [ProjectContactRelation]  WITH CHECK ADD  CONSTRAINT [FK_ProjectContactRelation_Contact] FOREIGN KEY([ContactId])
REFERENCES [Contact] ([ContactId])
GO
ALTER TABLE [ProjectContactRelation] CHECK CONSTRAINT [FK_ProjectContactRelation_Contact]
GO
/****** Object:  ForeignKey [FK_ProjectContactRelation_Project]    Script Date: 11/16/2010 14:07:59 ******/
ALTER TABLE [ProjectContactRelation]  WITH CHECK ADD  CONSTRAINT [FK_ProjectContactRelation_Project] FOREIGN KEY([ProjectId])
REFERENCES [Project] ([ProjectId])
GO
ALTER TABLE [ProjectContactRelation] CHECK CONSTRAINT [FK_ProjectContactRelation_Project]
GO
/****** Object:  ForeignKey [FK_ProjectCustomExpand_Project]    Script Date: 11/16/2010 14:07:59 ******/
ALTER TABLE [ProjectCustomExpand]  WITH CHECK ADD  CONSTRAINT [FK_ProjectCustomExpand_Project] FOREIGN KEY([ProjectCustomExpandId])
REFERENCES [Project] ([ProjectId])
GO
ALTER TABLE [ProjectCustomExpand] CHECK CONSTRAINT [FK_ProjectCustomExpand_Project]
GO
/****** Object:  ForeignKey [FK_ProjectEmailRelation_Project]    Script Date: 11/16/2010 14:07:59 ******/
ALTER TABLE [ProjectEmailRelation]  WITH CHECK ADD  CONSTRAINT [FK_ProjectEmailRelation_Project] FOREIGN KEY([ProjectId])
REFERENCES [Project] ([ProjectId])
GO
ALTER TABLE [ProjectEmailRelation] CHECK CONSTRAINT [FK_ProjectEmailRelation_Project]
GO
/****** Object:  ForeignKey [FK_RecentProject_Project]    Script Date: 11/16/2010 14:07:59 ******/
ALTER TABLE [RecentProject]  WITH CHECK ADD  CONSTRAINT [FK_RecentProject_Project] FOREIGN KEY([ProjectId])
REFERENCES [Project] ([ProjectId])
GO
ALTER TABLE [RecentProject] CHECK CONSTRAINT [FK_RecentProject_Project]
GO
/****** Object:  ForeignKey [FK_ReportFilter_BudgetState]    Script Date: 11/16/2010 14:07:59 ******/
ALTER TABLE [ReportFilter]  WITH CHECK ADD  CONSTRAINT [FK_ReportFilter_BudgetState] FOREIGN KEY([BudgetStateId])
REFERENCES [BudgetState] ([BudgetStateId])
GO
ALTER TABLE [ReportFilter] CHECK CONSTRAINT [FK_ReportFilter_BudgetState]
GO
/****** Object:  ForeignKey [FK_ReportFilter_Group]    Script Date: 11/16/2010 14:07:59 ******/
ALTER TABLE [ReportFilter]  WITH CHECK ADD  CONSTRAINT [FK_ReportFilter_Group] FOREIGN KEY([GroupId])
REFERENCES [Group] ([GroupId])
GO
ALTER TABLE [ReportFilter] CHECK CONSTRAINT [FK_ReportFilter_Group]
GO
/****** Object:  ForeignKey [FK_ReportFilter_Report]    Script Date: 11/16/2010 14:07:59 ******/
ALTER TABLE [ReportFilter]  WITH CHECK ADD  CONSTRAINT [FK_ReportFilter_Report] FOREIGN KEY([ReportId])
REFERENCES [Report] ([ReportId])
GO
ALTER TABLE [ReportFilter] CHECK CONSTRAINT [FK_ReportFilter_Report]
GO
