LIMIT NOT WORKING IN OUTSYSTEMS QUERY


Hello There,

I need to limit the number of records Using OutSystems Query.

When I try to use the limit in my Query it shows above error..

My Question is whether OutSystem doesn't support any limit or offset or between keywords in query ?

Hi Aravind,

"LIMIT" is a keyword specific to MySQL. Unless you have your environment connected to a MySQL database, it won't work. This has nothing to do with OutSystems, as the Platform passes on to the database whatever you write in an SQL query.

Also, are you sure you need a SQL query? Can't you use an Aggregate?

Hi Aravind M,

In order to limit rows in MSSQL, you have to use SELECT TOP 10 .... instead of LIMIT 10 (limit is a MySQL clause, not MSSQL)

Note :

SELECT LIMIT is not supported in all SQL databases.

For databases such as SQL Server or MSAccess, use the SELECT TOP statement to limit your results. The SELECT TOP statement is Microsoft's proprietary equivalent to the SELECT LIMIT statement.



Hi Aravind,

the allowed sql syntax doesn't depend on OS but on the database on your server.  


So you can find answers on any query questions on stack overflow for sql server, for example, not related to OS at all.


For this query try "select top 10 ..... from  ..... where ....."



Kilian Hekhuis wrote:

Hi Aravind,

"LIMIT" is a keyword specific to MySQL. Unless you have your environment connected to a MySQL database, it won't work. This has nothing to do with OutSystems, as the Platform passes on to the database whatever you write in an SQL query.

Also, are you sure you need a SQL query? Can't you use an Aggregate?


Hi Brother,

Thanks for the reply.

I'm sure I have to use limit in Query only.

Hi Aravind,

I was asking whether you really need a SQL query, as opposed to the preferred way of using an Aggregate. It doesn't directly have to do with your question, but if you are unsure about SQL syntax on various database servers, using Aggregates is better.

Kilian Hekhuis wrote:

Hi Aravind,

I was asking whether you really need a SQL query, as opposed to the preferred way of using an Aggregate. It doesn't directly have to do with your question, but if you are unsure about SQL syntax on various database servers, using Aggregates is better.

I'm asking any alternatives like Limit keyword in outsystems.


TOP is not working!!


Hi Aravind,

I provided you with a link, and Assif with actual code. Also, multiple people told you that the error has nothing to do with OutSystems, yet you persist in calling it OutSystems-related. You have enough information now to solve your problem. I'm going to close this topic, to prevent further derailment.