BDG Scenario 3

ActivityType.sql

If Exists (Select * From sysobjects Where name = N'ActivityType' And user_name(uid) = N'dbo')
    Drop Table dbo.ActivityType
Go

Create Table dbo.ActivityType
    (
    ActivityTypeId int Not Null Identity (1, 1),
    GradeScaleId int Not Null,
    Name nvarchar(50) Not Null,
    Description nvarchar(128) Null,
    Weight tinyint Not Null Constraint DF_ActivityType_Weight Default (1),
    DropLowest tinyint Not Null Constraint DF_ActivityType_DropLowest Default (0),
    LateType tinyint Not Null Constraint DF_ActivityType_LateType Default (0),
    LateValue tinyint Not Null Constraint DF_ActivityType_LateValue Default (0)
    )
Go
Alter Table dbo.ActivityType Add Constraint
    PK_ActivityType Primary Key Nonclustered
    (
    ActivityTypeId
    )
Go
Alter Table dbo.ActivityType Add Constraint
    FK_ActivityType_GradeScale Foreign Key
    (
    GradeScaleId
    ) References dbo.GradeScale
    (
    GradeScaleId
    )
Go