【问题标题】:SAS PROC SQL TRIM STATEMENTSAS PROC SQL TRIM 语句
【发布时间】:2011-01-10 12:18:09
【问题描述】:

我在使用 TRIM st 时遇到问题

这是我收到的错误;

ERROR: CLI prepare error: [Teradata][ODBC Teradata Driver][Teradata Database]
       Syntax error, expected something like ')' between a string or a Unicode
       character literal and the integer '9'.

这是它所引用的代码示例;

select trim(a.BR_CBS_CUST(FORMAT "9(4)")) || trim(a.STEM_CBS_CUST(FORMAT "9(6)")) || 
  trim(a.ACTP_CBS_CUST) || trim(a.CDG_CBS_CUST)  (char(20))as CUSTNO

谁能告诉我代码有什么问题?

谢谢。

【问题讨论】:

  • 你能告诉我们完整的proc sql语句吗?这看起来像是在使用 ODBC 直通,但仅从您提供给我们的 sn-p 中无法判断。谢谢。

标签: sql sas trim


【解决方案1】:

考虑 COMPRESS(),这在删除空格和连接字符串时会很有帮助。

【讨论】:

    【解决方案2】:

    您是否尝试过 LTRIM RTRIM 而不是普通的 Trim?

    【讨论】:

    • 您好,感谢您的回答。我最终解决了这个问题:inner join dqviewsp.CBS_PERSONS_XREF as b /*on a.CustNo=trim(b.BR_CBS_CUST) ||修剪(b.STEM_CBS_CUST)||修剪(b.ACTP_CBS_CUST)|| trim(b.CDG_CBS_CUST)*/ on cast(substr(a.custno,1,4) as smallint) = b.br_cbs_cust and cast(substr(a.custno,5,6) as integer) = b.stem_cbs_cust and cast (substr(a.custno,11,1) as smallint) = b.actp_cbs_cust 和 cast(substr(a.custno,12,1) as smallint) = b.cdg_cbs_cust
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2022-11-23
    • 2021-08-19
    • 1970-01-01
    • 1970-01-01
    • 2014-09-16
    • 1970-01-01
    相关资源
    最近更新 更多