Trying to migrate to MySql 5 from Sybase asa. I have a tables that have
column values that are calculated based on other columns in the table. How
can I accomplish the same in MySql?
Here is sample of my asa table:
CREATE TABLE "DBA"."OpptyDetail"
(
"OpptyDetailID" numeric(40,0) NOT NULL,
"OpptyID" numeric(40,0) NOT NULL,
"ProductID" numeric(40,0) NULL,
"ServiceID" numeric(40,0) NULL,
"Quantity" numeric(40,0) NULL,
"Amount" CASH NULL DEFAULT 0.0,
"Description" text NULL,
"UserDefined1" varchar(100) NULL,
"UserDefined2" varchar(100) NULL,
"UserDefined3" varchar(100) NULL,
"UserDefined4" varchar(100) NULL,
"UserDefined5" varchar(100) NULL,
"UserDefined6" varchar(100) NULL,
"UserDefined7" varchar(100) NULL,
"UserDefined8" varchar(100) NULL,
"UserDefined9" varchar(100) NULL,
"UserDefined10" varchar(100) NULL,
"CreateDate" timestamp NOT NULL DEFAULT
current timestamp,
"LastModified" timestamp NOT NULL DEFAULT
current timestamp,
"TotalAmt" CASH NULL COMPUTE
(Amount*Quantity),
"Discount" numeric(5,2) NULL DEFAULT
0,
"MaterialSurcharge" numeric(4,2) NULL DEFAULT 0,
"SubTotal" CASH NULL COMPUTE (case
Discount when 100 then 0 else
isnull(amount,0)-(isnull((Discount/100),0)*isnull(amount,0)) end),
"NetAmt" CASH NULL COMPUTE
(isnull(subtotal,0)*isnull(Quantity,0)),
"MaterialAmount" CASH NULL COMPUTE
((isnull(amount,0)*isnull(quantity,0))*(isnull(MaterialSurcharge,0)/100)),
PRIMARY KEY ("OpptyDetailID")
)
Attachment: [text/html]
Attachment: [text/html]
Attachment: [text/html]