Bob
Bob

Reputation: 121

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

Upvotes: 1

Views: 444

Answers (1)

JNevill
JNevill

Reputation: 50200

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
  );

Upvotes: 4

Related Questions