Page 1 of 1

QueryRecCount with SQL Server

Posted: Thu 12 Nov 2015 14:56
by Licences AAW
{UniDac 6.1.5}

Hi,

I've got a query like this to run on a SQL Server:

Code: Select all

select * from t1 order by right(f1, 3) desc
If the QueryRecCount property is not activated, the query is run successfully.

But, when the property is activated, TUniQuery complains about a bad syntax near '(' when asking for the record count.
Indeed, the generated query is:

Code: Select all

SET :PCOUNT = (SELECT COUNT(*) from t1 right(f1, 3) desc)
It seems _SetOrderBy procedure in CRParser unit doesn't support "calculated" order by.
A way to get my query run is to enclose each order by "calculated" field with parenthesis.

It would be convenient that this workaround is not mandatory.

Re: QueryRecCount with SQL Server

Posted: Thu 12 Nov 2015 16:42
by AlexP
Hello,

Specially for "complex" queries we have added possibility to set user SQL query for defining the number of records. For this, in design time you can set a "correct" query on the Update SQLs tab in the UniQuery editor, in runtime - in the UniQuery1.SQLRecCount property.

Re: QueryRecCount with SQL Server

Posted: Fri 13 Nov 2015 08:09
by Licences AAW
Thank's for the answer

I didn't know the property (because I create all my queries dynamically, I don't use design time editors)

Regards

Re: QueryRecCount with SQL Server

Posted: Fri 13 Nov 2015 12:45
by AlexP
If you have any other questions, feel free to contact us.