Problems Correcting SQL Scripts
Apr 16, 2008Guys l am having problems correcting the following SQL scripts ,kindly assist.
1.
create table TimeCardHours
(TimeCardDetailID int IDENTITY (30000,1)CONSTRAINT pkTimeCardDetailID PRIMARY KEY CLUSTERED,TimeCardID int CONSTRAINT fkTimeCardID FOREIGN KEY (TimeCardID) REFERENCES TimeCards (TimeCardID),DateWorked datetime not null CONSTRAINT chkDateWorked (StartDate) CHECK (DateWorked > ProjectstartDate) REFERENCES Projects (StartDate),ProjectID int CONSTRAINT fkProjectID FOREIGN KEY(ProjectID) REFERENCES Projects (ProjectID),WorkDescription varchar (50),BillableHours int CONSTRAINT chkBillableHours CHECK(BillableHours > 0),TotalCost money CONSTRAINT chkTotalCost CHECK(BillableHours * BillingRate for the employee to whom the time card is issued),WorkCodeID int CONSTRAINT fkWorkCodeID FOREIGN KEY (WorkCodeID) REFERENCES WorkCodes (WorkCodeID))
2.
create table TimeCardExpenses
(TimeCardExpensesID int IDENTITY (70000,1)CONSTRAINT pkTimeCardExpensesID PRIMARY KEY CLUSTERED,TimeCardID int CONSTRAINT fkTimeCardID FOREIGN KEY (TimeCardID) REFERENCES TimeCards (TimeCardID),ExpenseDate Datetime not null CONSTRAINT chkProjectEndDate (EndDate) CHECK (ExpenseDate < ProjectEndDate) REFERENCES Projects (EndDate),ProjectID int CONSTRAINT fkProjectID FOREIGN KEY(ProjectID) REFERENCES Projects (ProjectID),ExpenseDescription varchar (50),ExpenseAmount money CONSTRAINT chkExpenseAmount CHECK(ExpenseAmount > 0),ExpenseCodeID int CONSTRAINT fkExpenseCodeID FOREIGN KEY (ExpenseCodeID) REFERENCES ExpenseCodes (ExpenseCodeID))