使用SAS功能执行TeraData代码

时间:2015-04-27 20:39:53

标签: function sas teradata

我有一个关于在SAS中从TeraData执行/* 1 */ { "result" : [ { "product" : { "_id" : ObjectId("54f765564b10883c1800002c"), "total_invoice_fob_case" : 86.7099999999999940, "status" : "Draft", "discount" : "3.40", "effective_date" : ISODate("2013-08-01T06:00:00.000Z"), "version" : 2, "controlstate" : "AB", "controlstate_id" : ObjectId("54d510e9e3d793f581b6bb27"), "product" : "Product B", "product_id" : ObjectId("54f75b5e4b1088801a000628"), "size" : "1.75LTR", "size_id" : ObjectId("5418a3dd750b4294c2cb3a47"), "vendor" : "BEAM SUNTORY", "vendor_id" : ObjectId("54ef5aa74b1088781b000169"), "product_state_code" : "123", "net_fob_cost" : 86.7099999999999940, "change_reason" : [ "Other" ], "submitted" : { "submitted_date" : ISODate("2014-05-16T06:00:00.000Z") } } }, { "product" : { "_id" : ObjectId("54f765564b10883c1800002b"), "total_invoice_fob_case" : 86.7099999999999940, "status" : "Draft", "discount" : "4.40", "effective_date" : ISODate("2013-08-01T06:00:00.000Z"), "version" : 3, "controlstate" : "AB", "controlstate_id" : ObjectId("54d510e9e3d793f581b6bb27"), "product" : "Product A", "product_id" : ObjectId("54f75b5e4b1088801a000627"), "size" : "1.75LTR", "size_id" : ObjectId("5418a3dd750b4294c2cb3a47"), "vendor" : "BEAM SUNTORY", "vendor_id" : ObjectId("54ef5aa74b1088781b000169"), "product_state_code" : "123", "net_fob_cost" : 86.7099999999999940, "change_reason" : [ "Other" ], "submitted" : { "submitted_date" : ISODate("2014-05-16T06:00:00.000Z") } } } ], "ok" : 1 } 函数的问题。例如,在执行下面的代码时,我将在代码下面收到错误消息。在从TeraData创建表后,除了在SAS中使用年份函数之外,还有办法执行year()函数吗?

year()


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

1 个答案:

答案 0 :(得分:4)

您收到错误,因为Teradata中没有YEAR功能。相反,您可以使用Extract()

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