use ProjectManagement

Go

use [ProjectManagement]

Go

/****** Object:  Table [dbo].[Initiative]    Script Date: 03/19/2012 08:39:55 ******/
set ansi_Nulls on

Go

set Quoted_IdentIfier on

Go

set ansi_Padding on

Go

create table [dbo].[Initiative]([Id]         [int] identity(1, 1) not null
																,[Name]      [varchar](200) not null
																,[Budget]    [numeric](18, 2) not null
																,[StartDate] [datetime] null
																,[EndDate]   [datetime] null,
																constraint [pk_Initiative] 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

set ansi_Padding off

Go

/****** Object:  Table dbo.WeeklyStatus    Script Date: 03/16/2012 09:02:33 ******/
set ansi_Nulls on

Go

set Quoted_IdentIfier on

Go

create table dbo.WeeklyStatus(Id                   int identity(1, 1) not null
															,WeekOf              datetime not null
															,Cost                numeric(18, 2) not null
															,InitiativeId        int null
															,ActiveDefectCount   int null
															,ResolvedDefectCount int null
															,ClosedDefectCount   int null
															,OtherDefectCount    int null,
															constraint pk_WeeklyStatus 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.WeeklyStatus
	with check add constraint fk_WeeklyStatus_Initiative foreign key(InitiativeId) references dbo.Initiative (Id)

Go

alter table dbo.WeeklyStatus
	check constraint fk_WeeklyStatus_Initiative

Go

use [ProjectManagement]

Go

/****** Object:  Table [dbo].[Deliverable]    Script Date: 03/19/2012 08:40:13 ******/
set ansi_Nulls on

Go

set Quoted_IdentIfier on

Go

set ansi_Padding on

Go

create table [dbo].[DeliverAble]([Id]            [int] not null
																 ,[Name]         [varchar](200) not null
																 ,[IsCompleted]  [bit] not null
																 ,[InitiativeId] [int] null)
on [Primary]

Go

set ansi_Padding off

Go

alter table [dbo].[DeliverAble]
	with check add constraint [fk_DeliverAble_Initiative] foreign key([InitiativeId]) references [dbo].[Initiative] ([Id])

Go

alter table [dbo].[DeliverAble]
	check constraint [fk_DeliverAble_Initiative]

Go 

use ProjectManagement

Go

insert into dbo.Initiative
						(Name,Budget,StartDate,EndDate)
values      ('Bob''s Second',850,'2012/03/29','2012/04/22')

Go 
insert into dbo.Initiative
						(Name,Budget,StartDate,EndDate)
values      ('Black Pearl Gun Refit',9900,'2012/03/22','2012/04/30')

Go 
insert into dbo.Initiative
						(Name,Budget,StartDate,EndDate)
values      ('Hold on to old tricks',260,'2012/03/23','2012/05/6')

Go 
insert into dbo.Initiative
						(Name,Budget,StartDate,EndDate)
values      ('Willie''s Big Shot',100,'2012/03/25','2012/05/10')

Go 
