Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
JLuebbert
Regular Visitor

Teradata Import Query Error

I am able to run the query below in Teradata without any errors

 

SELECT 
YEAR(DATE_FIELD) AS DATE_YEAR
,A.FIELD_1
,A.FIELD_2
,B.FIELD_3
,SUM(AMT_1) AS SUM_AMT_1
,SUM(AMT_2) AS SUM_AMT_2
FROM TABLE_1 AS A
LEFT JOIN TABLE_2 AS B ON A.FIELD_1 = B.FIELD_1
GROUP BY YEAR(DATE_FIELD),FIELD_1,FIELD_2,FIELD_3

but when entered into the SQL Statement section of the Teradata database connection window I get the an error that looks like a Teradata error saying: 

 

DataSource.Error: Teradata: [Teradata Database] [3706] Syntax error: expected something between the 'SELECT' keyword and the 'YEAR' keyword.

 

I am using Import as the connection type.  Is there a function other than YEAR() that should be used?  What is the true cause of this error as I know the syntax is correct.

1 ACCEPTED SOLUTION
Anonymous
Not applicable

@JLuebbert,

Can you try SELECT EXTRACT(YEAR FROM DATE_FIELD)?

View solution in original post

3 REPLIES 3
Anonymous
Not applicable

@JLuebbert,

Can you try SELECT EXTRACT(YEAR FROM DATE_FIELD)?

Thanks, that worked!  Is there a reference or guide somewhere that outlines which functions do and do not work as with YEAR()?  Because SUM() worked without any issue and I could not find any resources that said what I should use instead of YEAR().

Anonymous
Not applicable

@JLuebbert,

I tried select year(from date_field) but I got the same error message. Perhaps your teradata client somehow translates it into extract(year from date_field)?

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.