从链接服务器查询中选择

时间:2014-09-23 15:41:48

标签: sql sql-server linked-server

我有一个问题我不是很了解...... 我正在查询与链接服务器连接的sql表,当我'选择*'时,select工作正常 enter image description here

但是一旦我开始选择单个列,我就会收到错误: enter image description here

列来自哪里,SQLserver或链接服务器无关紧要,按名称尝试任何列都会导致此错误...

select DiscrepancyID 
from (select distinct * 
      from 
      (Select  Discrepancy.*
             , cast(id as varchar) as id
             , me2.d
             , tailnumber
             , me2.fleet_code 
       From Discrepancy, 
            openquery(AIROPS, 'Select aircraftid as id
                                    , tailnumber
                                    , oagactype
                                    , operator 
                               FROM AIROPS.AIRCRAFT') airops 
        join openquery(meprd, 'Select equipment
                                    , REGEXP_SUBSTR(sceptre_fleet_description, ''[[:digit:]]{3}'' ) as d 
                               FROM ME_DWH.FLEET_CODES') me 
         on (airops.operator+' '+ airops.oagactype) = REPLACE(me.equipment, '  ',' ') 
         join openquery(meprd, 'Select fleet_code
                                     , REGEXP_SUBSTR(sceptre_fleet_description, ''[[:digit:]]{3}'' ) as d 
                                FROM ME_DWH.FLEET_CODES 
                                Where fleet_code != ''NA''') me2 
         on me.d = me2.d) link1) link

关于为什么的任何想法?

0 个答案:

没有答案