Skip to main content
Announcements
NEW: Seamless Public Data Sharing with Qlik's New Anonymous Access Capability: TELL ME MORE!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

New column from SQL query

hi

i'am in traning now

I have this

SQL SELECT AddressLine1,
CustomerKey,
DateFirstPurchase,
EmailAddress,
EnglishEducation,
FirstName,
LastName,
Gender,
Phone,
BirthDate
FROM AdventureWorksDW2014.dbo.DimCustomer;

need to make new column as "AGE" from BirthDate

if I use AGE(today(),BirthDate) as AGE is not make new column:

ErrorSource: Microsoft OLE DB Provider for SQL Server, ErrorMsg: 'today' is not a recognized built-in function name.

SQL SELECT AddressLine1,

    CustomerKey,

    DateFirstPurchase,

    EmailAddress,

    EnglishEducation,

    FirstName,

    LastName,

    Gender,

    Phone,

    BirthDate,

    age(today(),birthday) as AGE

FROM AdventureWorksDW2014.dbo.DimCustom

but if I use this function for make dimension is work

please help me........

1 Solution

Accepted Solutions
Kushal_Chawda


LOAD *,

           age(today(),BirthDate) as AGE;

SQL SELECT AddressLine1,

    CustomerKey,

    DateFirstPurchase,

    EmailAddress,

    EnglishEducation,

    FirstName,

    LastName,

    Gender,

    Phone,

    BirthDate

FROM AdventureWorksDW2014.dbo.DimCustom

View solution in original post

6 Replies
ajsjoshua
Specialist
Specialist

Hi,

Try this


Interval(Now()-BirthDate,'dd hh:mm')

MarcoWedel

‌use a preceding load.

Load age(...) as age, *;

sql select ...

from ...

regards

marco

Not applicable
Author

load age(today(),birthdate) as AGE,*;

is before table select ??

load age(today(),birthdate) as AGE,*;
SQL SELECT AddressLine1,
CustomerKey,
DateFirstPurchase,
EmailAddress,
EnglishEducation,
FirstName,
LastName,
Gender,
Phone,
BirthDate
FROM AdventureWorksDW2014.dbo.DimCustomer;

is not work....

Kushal_Chawda


LOAD *,

           age(today(),BirthDate) as AGE;

SQL SELECT AddressLine1,

    CustomerKey,

    DateFirstPurchase,

    EmailAddress,

    EnglishEducation,

    FirstName,

    LastName,

    Gender,

    Phone,

    BirthDate

FROM AdventureWorksDW2014.dbo.DimCustom

Not applicable
Author

Excellent

is work

thanks

MarcoWedel

Yes, but you might have to adjust field names as they are case sensitive.

Hope this helps

Regards

Marco