Advanced query in Linked Server entitie


I'm having some problems with a advanced query made on a Entitie that comes from a linked server.

select Loja, sum({SalesReportData}.[QuantidadeVendida])
From {SalesReportData}

very simple query but the result is:

"Error in advance query GetTotalVendas": The multi-part identifier "AliasServer" could not be bound."

Normal querys work fine...but the advanced ones don´t can some one provide help?


Reply to myself...

I found the problem...

The problem is that Sql server only accepts 4 names to extrapulate from a Data base.


server.database.table.colum <- this is the max

Im my case I was using -> server.database.schema.table.colum

this produces the error...

The solution?! well I iam still triyng possible ones one of those is using Alias .
This forum is one helps !! great!!!
Hi Nuno, and welcome back to the OutSystems community forums, after a 1 year of hiatus. It's good to still have you with us.

From the impression I get from this specific thread, you were on your way into studying alternatives about how to do what you wanted to.

Specifically, there is one thing that usually happens in forums, though: people usually only reply if they have gone through the problem you are going through. It's not that people don't want to help, but it's just that people don't know how to help you with your specific case! :)

That being said, however, what's the status of your current problem? Do let us know, and let's see if someone knows a better way to do what you're trying to do.


Paulo Tavares
Hi Nuno,

you have two approaches:

1. create alias for tables in advanced queries:

select sum(sales.[QuantidadeVendida]) 
From {SalesReportData} sales

2. Create synonyms for each table on database and update field physical_table_name in Extension

sales_synonym = server.database.schema.SalesReportData
So physical_table_name of SalesReportData looks like this: sales_synoym

Bruno Cavaco
Hi Nuno,
this error happend with me too  that's because i use  the colum name  in filter  but i forget to put the tabel name  in jion in from cluase  so after i put it it work with me .
ex of my old version of code  :
select * from table1 where
the solution put table2 in from :
select * from table1 inner join tabel2 on  where

Asmaa Gad
Two things to look at for this problem are:

1. Have you joined the AliasServer table into your query? If you are using an Aggregate you need to bring in the AliasServer table as a source. Double click the GetSalesReportData icon, then click sources and drop & drop an AliasServer entity from under the Data tab.

If you are using SQL (which I think 
Nuno Bairro is) then you need something like:
INNER JOIN {AliasServer} ON {AliasServer}.[myUniqueData] = {SalesReportData}.[myUniqueData]


2. The error says "
 The multi-part identifier "AliasServer". I've had this error a few times when I started using SQL with OutSystems. I was mistakenly having only {MyTableName}.*  or even just  {MyTableName} 
I wasn't including which column to look in. I needed something like 
 {MyTableName} .[productID]

Using Advance Query Extension. Any questions let me know.