简体   繁体   中英

Executing TeraData codes using SAS function

I have a question about executing the year() function in TeraData from SAS. For example, when executing the code below, I will get the error message below the codes. Is there a way to execute the year() function besides using the year function in SAS after the table is created from TeraData?

 select * from connection to teradata (
      select customer_id
           , year(date)
      from base.customers a
  );


ERROR: Teradata execute: Syntax error: expected something between ',' and the 'year' keyword

You are getting an error because there is no YEAR function in Teradata. Instead you can use Extract() :

 select * from connection to teradata (
      select customer_id
           , EXTRACT(YEAR FROM date)
      from base.customers a
  );

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM