“Invalid column name” error on SQL statement from OpenQuery results

前端 未结 4 847
不思量自难忘°
不思量自难忘° 2020-12-18 18:25

I\'m trying to perform a SQL query through a linked SSAS server. The initial query works fine:

SELECT \"Ugly OLAP name\" as \"Value\" 
FROM OpenQuery( OLAP,         


        
4条回答
  •  野趣味
    野趣味 (楼主)
    2020-12-18 19:20

    You're using "Value" as a column alias, and I don't think the alias can appear in the where clause. It's simply used to name the returned column value. Your where clause should refer to the original column name:

    SELECT "Ugly OLAP name" as "Value" 
    FROM OpenQuery( OLAP, 'OLAP Query')
    WHERE "Ugly OLAP name" > 0
    

提交回复
热议问题