Results 1 to 6 of 6
  1. #1
    Join Date
    Apr 2008
    Posts
    2

    Unanswered: Problems correcting SQL scripts

    Guys 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))

  2. #2
    Join Date
    Nov 2003
    Posts
    2,935
    Provided Answers: 12
    And your problem is?

  3. #3
    Join Date
    Apr 2008
    Posts
    2
    if l run these scripts in the query analiser they a givin me errors l am failing to locate.

  4. #4
    Join Date
    Nov 2003
    Posts
    2,935
    Provided Answers: 12
    Quote Originally Posted by darlingpedro
    if l run these scripts in the query analiser they a givin me errors l am failing to locate.
    We are not able to see your monitor.
    If you want help, you have to give more details.

    The exact error message is the absolute minimum.

  5. #5
    Join Date
    May 2004
    Location
    Seattle
    Posts
    1,313
    1. use some kind of formatting in your code.
    2. use [code] tags around it so the formatting is preserved.
    3. this check constraint makes no sense: CHECK(BillableHours * BillingRate for the employee to whom the time card is issued)
    4. may be other problems but you scripts are too opaque to spot them at a glance.

  6. #6
    Join Date
    Jun 2004
    Location
    Long Island
    Posts
    696
    analiser, sounds like it hurts.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •