错误:Teradata 准备:在 SAS 中使用日期格式“ddmmyyy”时出现语法错误

发布于 2025-01-15 06:54:06 字数 1177 浏览 0 评论 0原文

我正在使用此代码从该数据库中提取信息。但是,它向我显示了这个错误:

错误:Teradata 准备:语法错误,字符串或 Unicode 字符文字与单词之间应出现类似“)”的内容 'd'。 SQL 语句为:WITH vmher102ult as ( select cod_cte, max(fec_consulta) as max_fec_consulta from klarmxpw_her.vmher102 其中 cod_cte 不在 ('','0','00000000') 中并且 fec_consulta>='01MAR2021'd 按 cod_cte 分组) 选择 t1.* 从 klarmxpw_her.vmher101 作为 t1 内部连接 ​​vmher102ult 作为 t2 在 t1.cod_cte=t2.cod_cte 上并且 t1.fec_consulta=t2.max_fec_consulta。

我用于此传递的代码如下:

proc sql;
connect to teradata as tera (user=&tuser. password=&tpass. server='TDMX03');
    create table vmher101_m as 
        select * from connection to tera (
            WITH vmher102ult as (
            select cod_cte, max(fec_consulta) as max_fec_consulta
                from klarmxpw_her.vmher102
                    where cod_cte not in ('','0','00000000') 
                    and fec_consulta>='01MAR2021'd
                    group by cod_cte)
    select t1.* 
        from klarmxpw_her.vmher101 as t1
        inner join vmher102ult as t2 
        on t1.cod_cte=t2.cod_cte and t1.fec_consulta=t2.max_fec_consulta);
disconnect from ter;

有人知道我能做什么吗?

I'm using this code to extract information from this database. However, it is showing me this error:

ERROR: Teradata prepare: Syntax error, expected something like ')' between a string or a Unicode character literal and the word
'd'. SQL statement was: WITH vmher102ult as ( select cod_cte, max(fec_consulta) as max_fec_consulta from
klarmxpw_her.vmher102 where cod_cte not in ('','0','00000000') and fec_consulta>='01MAR2021'd group by cod_cte) select t1.*
from klarmxpw_her.vmher101 as t1 inner join vmher102ult as t2 on t1.cod_cte=t2.cod_cte and
t1.fec_consulta=t2.max_fec_consulta.

The code I'm using for this pass through is the following:

proc sql;
connect to teradata as tera (user=&tuser. password=&tpass. server='TDMX03');
    create table vmher101_m as 
        select * from connection to tera (
            WITH vmher102ult as (
            select cod_cte, max(fec_consulta) as max_fec_consulta
                from klarmxpw_her.vmher102
                    where cod_cte not in ('','0','00000000') 
                    and fec_consulta>='01MAR2021'd
                    group by cod_cte)
    select t1.* 
        from klarmxpw_her.vmher101 as t1
        inner join vmher102ult as t2 
        on t1.cod_cte=t2.cod_cte and t1.fec_consulta=t2.max_fec_consulta);
disconnect from ter;

Does anybody know what can I do?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

怪我入戏太深 2025-01-22 06:54:06

您需要在从连接到tera之后的()内使用TERADATA代码。

尝试

and fec_consulta>= DATE '2021-03-01'

Teradata 文档

You need to use TERADATA code inside the () after from connection to tera.

Try

and fec_consulta>= DATE '2021-03-01'

Teradata Documentation

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文