====== 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 =====
* EBTimeSheetLineID
===== Foreign Keys =====
^ Constraint ^ Columns ^ References ^ Delete/update action ^
| EBTimeSheet | EBTimeSheetID | [[database:tables:pears_ebtimesheet|pears.EBTimeSheet (EBTimeSheetID)]] | NOT NULL; |
| EBPayBand | EBPayBandID | [[database:tables:pears_ebpayband|pears.EBPayBand (EBPayBandID)]] | NOT NULL; |
===== Referenced By =====
* No incoming foreign keys found.
===== Indexes =====
* No indexes found.
===== 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