ALTER TABLE ADD COLUMN

Modifies the table structure by adding a new column.

Syntax:

ALTER TABLE table_name ADD COLUMN new_column_name = { sql_expression}

Example:

ALTER TABLE customer
ADD COLUMN customerType = {CASE WHEN "Source Type"=1 THEN 'Retail' ELSE 'Wholesale' END}

ALTER TABLE tStageCustLedgerEntry
ADD COLUMN wAgingBucket =
{
IIF([Open]=0 AND [wRemainingAmountLCY]<>0,
CASE
WHEN [wAgingDaysOverdue] <= 0  THEN 0
WHEN [wAgingDaysOverdue] > 0  AND [wAgingDaysOverdue] <= 30 THEN 30
WHEN [wAgingDaysOverdue] > 30 AND [wAgingDaysOverdue] <= 60 THEN 60
WHEN [wAgingDaysOverdue] > 61 AND [wAgingDaysOverdue] <= 90 THEN 90
WHEN [wAgingDaysOverdue] > 90 THEN 120
ELSE 0
END,
0)
}

 

Was this article helpful?
0 out of 0 found this helpful

Comments

0 comments

Please sign in to leave a comment.