Subject | Question about computed field and datediff function |
---|---|
Author | Sławek Cabaj |
Post date | 2010-05-11T08:38:48Z |
Hello,
I'd like to create a computed field, something like that
CREATE TABLE TABLE1 (
BORN DATE,
AGE COMPUTED BY (DATEDIFF(YEAR FROM DATE BORN TO CURRENT_DATE))
);
or perhaps (?) better like this
CREATE TABLE TABLE1 (
BORN DATE,
AGE COMPUTED BY ( CASE WHEN (BORN IS NULL) THEN 0 ELSE (DATEDIFF(YEAR FROM DATE BORN TO CURRENT_DATE)) END)
);
I get an error 'Invalid token... BORN'
so the question is: is it possible in such situation to use a field name in datediff function ?
[Non-text portions of this message have been removed]
I'd like to create a computed field, something like that
CREATE TABLE TABLE1 (
BORN DATE,
AGE COMPUTED BY (DATEDIFF(YEAR FROM DATE BORN TO CURRENT_DATE))
);
or perhaps (?) better like this
CREATE TABLE TABLE1 (
BORN DATE,
AGE COMPUTED BY ( CASE WHEN (BORN IS NULL) THEN 0 ELSE (DATEDIFF(YEAR FROM DATE BORN TO CURRENT_DATE)) END)
);
I get an error 'Invalid token... BORN'
so the question is: is it possible in such situation to use a field name in datediff function ?
[Non-text portions of this message have been removed]