TSQL上的DB2错误 [英] DB2 error on TSQL

查看:290
本文介绍了TSQL上的DB2错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我收到此错误:[OLE / DB提供程序返回消息:[IBM] [CLI驱动程序] [DB2 / linuxx8664] SQL0206NLS_SCHEDULED_DATE在使用的上下文中无效。 SQLSTATE = 42703)
OLE DB错误跟踪[OLE / DB提供程序'MSDASQL'IColumnsInfo:GetColumnsInfo返回0x80004005:
Msg7339,级别1,状态1,行83
OLE DB提供程序'MSDASQL'报了一个错误。

I am getting this error: [OLE/DB provider returned message: [IBM][CLI Driver] [DB2 / linuxx8664] SQL0206N "LS_SCHEDULED_DATE" is not valid in the context where used. SQLSTATE=42703) OLE DB error trace [OLE /DB Provider 'MSDASQL' IColumnsInfo: GetColumnsInfo returned 0x80004005: Msg7339, Level 1, State 1, Line 83 OLE DB provider 'MSDASQL' reported an error.

我收到此错误的代码如下:

The code I am getting this error is as follows:

IF OBJECT_ID('tempdb..#Temp1') is not null begin drop table #Temp1

select * 

into #Temp1
from openquery(LnkServer,

'
Select 
X.loan_number, 
X.ls_code,
x.ls_actual_completion_date
x.ls_scheduled_completion_date

,max(Case WHEN (ls_code = ''924'' and ls_scheduled_completion_date <> (''01/01/1900'')
             then ls_scheduled_completion_code
               else NULL End) as Ls_scheduled_completion_date

,max(Case WHEN (ls_code = ''926'' and ls_scheduled_completion_date <> (''01/01/1900'')
             then ls_scheduled_completion_code
               else NULL End) as Ls_scheduled_completion_date

,max(Case WHEN (ls_code = ''927'' and ls_scheduled_completion_date <> (''01/01/1900'')
             then ls_scheduled_completion_code
               else NULL End) as Ls_scheduled_completion_date

,max(Case WHEN (ls_code = ''928'' and ls_scheduled_completion_date <> (''01/01/1900'')
             then ls_scheduled_completion_code
               else NULL End) as Ls_scheduled_completion_date

from master x
     inner join(select loan_number, MAX(ls_scheduled_completion_date) as COMPL_DATE
                MAX(ls_actual_completion_date) as APPROVAL_DATE

     Where LS_code in (''924'', ''926'', ''927'', ''928'', ''D08'', ''H38'', ''H79'', ''H42'',
                       ''M40'', ''M29'', ''M10'', ''M40'', ''P31'', ''P49'', ''S17'')

      Group by loan_number order by loan_number) y
      on x.loan_number = y.loan_number
         and x.ls_scheduled_date = y.Compl_date
         and x.ls_actual_completion_date = y.approval_date
      Group by x.loan_number, x.ls_actual_completion_date, ls_scheduled_date

for fetch only with ur')


推荐答案

不是你的意思是 LS_SCHEDULED_COMPLETION_DATE

查询中的任何位置似乎不是 LS_SCHEDULED_DATE ,而不在 / code>和 group by 子句,我发生错误。

There doesn't appear to be a LS_SCHEDULED_DATE anywhere in the query other than in the on and group by clauses where I'm assuming the error is occurring.

从IBM的自己的 publib 网站


对于SELECT或DELETE语句,指定的列不是语句中FROM子句中标识的任何表或视图的列。

For a SELECT or DELETE statement, the specified column is not a column of any of the tables or views identified in a FROM clause in the statement.

验证名称是在SQL语句中正确指定。对于SELECT语句,请确保所有必需的表都在FROM子句中命名。

Verify that the names are specified correctly in the SQL statement. For a SELECT statement, ensure that all the required tables are named in the FROM clause.

这篇关于TSQL上的DB2错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆