create table SaleOrderLines ( "Id" integer not null, "DocId" integer not null, "ItemId" integer not null, "Qty" numeric(12,4) not null, "SellPrice" numeric(12,4) not null, "Discount" numeric(12,4) not null default 0, "VatRate" numeric(3,2) not null, "RowSum" numeric(12,4) not null, "ItemName" varchar(250) not null, "SaleLineGuid" varchar(60), "RegQty" numeric(12,4) not null, "PayedQty" numeric(12,4) not null default 0, "Status" integer default 1, "InsDateTime" timestamp not null default current timestamp, primary key ("Id") ) GO ALTER TABLE SaleOrderLines ADD NOT NULL FOREIGN KEY "DocId_SaleOrders_Id" ("DocId") REFERENCES "SaleOrders" ("Id") ON UPDATE CASCADE ON DELETE CASCADE GO