Table of Contents



pears.EBTimeSheetLine

Generated schema reference. Regenerate this page from the SQL unload; keep hand-maintained business notes in the narrative namespace.

Description

Expense Benefit timesheet line

Columns

Column Type Null Default Comment
EBTimeSheetLineID char(20) NOT NULL
EBTimeSheetID char(20) NOT NULL
EBPayBandID char(20) NOT NULL
LineNumber smallint NULL
UnitsPaid double NULL 0
UnitsCharged double NULL 0
PayRate double NULL 0
ChargeRate double NULL 0
Description long varchar NULL
Grade char(4) NULL

Primary Key

Foreign Keys

Constraint Columns References Delete/update action
EBTimeSheet EBTimeSheetID pears.EBTimeSheet (EBTimeSheetID) NOT NULL;
EBPayBand EBPayBandID pears.EBPayBand (EBPayBandID) NOT NULL;

Referenced By

Indexes

Triggers

Name Timing Event
EBTimesheetLine_Insert before insert order 1

Original SQL

-- IQX database structure split by table
-- Source: IQXDatabaseStructure - with comments.sql
-- Table: "pears"."EBTimeSheetLine"
-- Table comment: Expense Benefit  timesheet line
-- Statement count: 6
 
CREATE TABLE "pears"."EBTimeSheetLine" (
    "EBTimeSheetLineID"              CHAR(20) NOT NULL
   ,"EBTimeSheetID"                  CHAR(20) NOT NULL
   ,"EBPayBandID"                    CHAR(20) NOT NULL
   ,"LineNumber"                     SMALLINT NULL
   ,"UnitsPaid"                      DOUBLE NULL DEFAULT 0
   ,"UnitsCharged"                   DOUBLE NULL DEFAULT 0
   ,"PayRate"                        DOUBLE NULL DEFAULT 0
   ,"ChargeRate"                     DOUBLE NULL DEFAULT 0
   ,"Description"                    long VARCHAR NULL
   ,"Grade"                          CHAR(4) NULL
   ,PRIMARY KEY ("EBTimeSheetLineID" ASC) 
)
GO
 
 
COMMENT ON TABLE "pears"."EBTimeSheetLine" IS 
	'Expense Benefit  timesheet line'
GO
 
 
ALTER TABLE "pears"."EBTimeSheetLine"
    ADD NOT NULL FOREIGN KEY "EBTimeSheet" ("EBTimeSheetID" ASC)
    REFERENCES "pears"."EBTimeSheet" ("EBTimeSheetID")
GO
 
 
ALTER TABLE "pears"."EBTimeSheetLine"
    ADD NOT NULL FOREIGN KEY "EBPayBand" ("EBPayBandID" ASC)
    REFERENCES "pears"."EBPayBand" ("EBPayBandID")
GO
 
 
CREATE TRIGGER "EBTimesheetLine_Insert" BEFORE INSERT ORDER 1 ON
"pears"."EBTimeSheetLine"
REFERENCING NEW AS "new_line"
FOR each ROW
WHEN("new_line"."linenumber" IS NULL)
BEGIN
  SET "new_line"."linenumber" = "isnull"((SELECT "max"("linenumber") FROM "EBtimesheetline" WHERE "EBtimesheetid" = "new_line"."EBtimesheetid"),0)+1
END
GO
 
 
COMMENT TO PRESERVE FORMAT ON TRIGGER "pears"."EBTimeSheetLine"."EBTimesheetLine_Insert" IS 
{CREATE TRIGGER EBTimesheetLine_Insert 
 BEFORE INSERT ORDER 1 ON
pears.EBTimeSheetLine
REFERENCING NEW AS new_line
FOR each ROW
WHEN(new_line.linenumber IS NULL)
BEGIN
  SET new_line.linenumber=isnull((SELECT MAX(linenumber) FROM EBtimesheetline WHERE EBtimesheetid = new_line.EBtimesheetid),0)+1
END
}
GO