Talend中的动态SQL错误

时间:2017-06-01 10:58:56

标签: sql sql-server database talend

我正在学习Talend。我试图连接到数据库,只是从中拉出表格。 我设法创建了连接元数据,并且能够连接到SQL Server数据库。

但是,当我将连接拖放到作业中(作为tsMSSqlInput)并运行作业时,我收到以下错误:

Exception in component tMSSqlInput_1

[FATAL]: talend_train.engia_test_0_1.ENGIA_Test - tMSSqlInput_1 An object or 
column name is missing or empty. For SELECT INTO statements, verify each 
column has a name. For other statements, look for empty alias names. Aliases 
defined as "" or [] are not allowed. Change the alias to a valid name.
java.sql.SQLException: An object or column name is missing or empty. For 
SELECT INTO statements, verify each column has a name. For other statements, 
look for empty alias names. Aliases defined as "" or [] are not allowed. 
Change the alias to a valid name.

我的猜测是动态查询有问题(使用上下文变量):

"SELECT \""+context.Engica_Connect_Schema+"\".CM_AU_TA.AU_TA_UN,
    \""+context.Engica_Connect_Schema+"\".CM_AU_TA.AU_TA_TN,
    \""+context.Engica_Connect_Schema+"\".CM_AU_TA.AU_TA_PK,
    \""+context.Engica_Connect_Schema+"\".CM_AU_TA.AU_TA_SK,
    \""+context.Engica_Connect_Schema+"\".CM_AU_TA.AU_TA_FN,
    \""+context.Engica_Connect_Schema+"\".CM_AU_TA.AU_TA_OV,
    \""+context.Engica_Connect_Schema+"\".CM_AU_TA.AU_TA_NV,
    \""+context.Engica_Connect_Schema+"\".CM_AU_TA.AU_TA_ID,
    \""+context.Engica_Connect_Schema+"\".CM_AU_TA.AU_TA_DT,
    \""+context.Engica_Connect_Schema+"\".CM_AU_TA.SY_FI_DA,
    \""+context.Engica_Connect_Schema+"\".CM_AU_TA.SQL_TIMESTAMP"
+"
   FROM \""+context.Engica_Connect_Schema+"\".CM_AU_TA"

双引号肯定有问题,我不知道在哪里或如何。

此外,当我尝试运行查询以获得预览时,我得到的是: Incorrect Syntax error 有什么想法吗?

0 个答案:

没有答案