<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"><channel><category>pcsoft.us.windev</category><copyright>Copyright 2026, PC SOFT</copyright><lastBuildDate>21 Apr 2015 15:58:00 Z</lastBuildDate><pubDate>21 Apr 2015 00:33:00 Z</pubDate><description>I am using WinDev 19 and if I use MOD() in an SQL WHERE clause WinDev returns error;&#13;
&#13;
"Error returned by &lt;&gt; server:&#13;
Internal Error in WDSQL DLL."&#13;
&#13;
Basically I need to know if the pages being selected are exactly divisible by the pagecount field in the data file.&#13;
&#13;
I have simplified my code to do a test proof and this generates the error;&#13;
dsSTMT is Data Source cConnection is Connection = DatabaseConnection nPageValue is int = 64 cFilterString is string = StringBuild("WHERE MOD(%1,pagecount)=0",nPageValue) SQLStatement is string = "Select * from laydown %1" IF HExecuteSQLQuery(dsSTMT ,cConnection ,hQueryWithoutCorrection,StringBuild(SQLStatement,cFilterString)) THEN Info("Success") ELSE Info(HErrorInfo()) END&#13;
Strangely if I wanted the MOD the other way around, It does not error;&#13;
MOD(pagecount,%1)=0&#13;
I have a work around by using;&#13;
DIV(%1,pagecount)=ROUND(DIV(%1,pagecount),0)&#13;
But that not very neat, has anyone else come across this? or is there another way to achieve the same result?&#13;
&#13;
I have used MOD() in another programming languages SQL WHERE so I don't thinks it's an SQL standard issue.&#13;
&#13;
I am relatively new to WinDev so maybe it's me, but I can't see that it is.&#13;
&#13;
Gary.</description><ttl>30</ttl><generator>WEBDEV</generator><language>en_US</language><link>https://forum.pcsoft.fr/es-ES/pcsoft.us.windev/51675-mod-returns-error-when-used-sql-when-clause/read.awp</link><title>MOD() returns error when used in SQL WHEN clause</title><managingEditor>moderateur@pcsoft.fr (El moderador)</managingEditor><webMaster>webmaster@pcsoft.fr (El webmaster)</webMaster><item><author>guest</author><category>pcsoft.us.windev</category><comments>https://forum.pcsoft.fr/es-ES/pcsoft.us.windev/51675-mod-returns-error-when-used-sql-when-clause-51699/read.awp</comments><pubDate>21 Apr 2015 15:58:00 Z</pubDate><description>Hi guys,&#13;
&#13;
Unless I'm missing a point, it is not necessary to make a sub query. You can do that in a simple query.&#13;
&#13;
SELECT *,…</description><guid isPermaLink="true">https://forum.pcsoft.fr/es-ES/pcsoft.us.windev/51675-mod-returns-error-when-used-sql-when-clause-51699/read.awp</guid><link>https://forum.pcsoft.fr/es-ES/pcsoft.us.windev/51675-mod-returns-error-when-used-sql-when-clause-51699/read.awp</link><source url="https://forum.pcsoft.fr/es-ES/pcsoft.us.windev/51675-mod-returns-error-when-used-sql-when-clause/read.awp">MOD() returns error when used in SQL WHEN clause</source><title>Re: MOD() returns error when used in SQL WHEN clause</title></item><item><author>guest</author><category>pcsoft.us.windev</category><comments>https://forum.pcsoft.fr/es-ES/pcsoft.us.windev/51675-mod-returns-error-when-used-sql-when-clause-51683/read.awp</comments><pubDate>21 Apr 2015 09:38:00 Z</pubDate><description>Thanks Arie,&#13;
&#13;
I'll have a play with that, it looks neater than mine, I'll try and do some tests and see if your way is faster …</description><guid isPermaLink="true">https://forum.pcsoft.fr/es-ES/pcsoft.us.windev/51675-mod-returns-error-when-used-sql-when-clause-51683/read.awp</guid><link>https://forum.pcsoft.fr/es-ES/pcsoft.us.windev/51675-mod-returns-error-when-used-sql-when-clause-51683/read.awp</link><source url="https://forum.pcsoft.fr/es-ES/pcsoft.us.windev/51675-mod-returns-error-when-used-sql-when-clause/read.awp">MOD() returns error when used in SQL WHEN clause</source><title>Re: MOD() returns error when used in SQL WHEN clause</title></item><item><author>guest</author><category>pcsoft.us.windev</category><comments>https://forum.pcsoft.fr/es-ES/pcsoft.us.windev/51675-mod-returns-error-when-used-sql-when-clause-51681/read.awp</comments><pubDate>21 Apr 2015 09:05:00 Z</pubDate><description>Hi Gary,&#13;
I did a small test and with the same error.&#13;
I looks like MOD is not supported in the WHERE clause??&#13;
But you can use …</description><guid isPermaLink="true">https://forum.pcsoft.fr/es-ES/pcsoft.us.windev/51675-mod-returns-error-when-used-sql-when-clause-51681/read.awp</guid><link>https://forum.pcsoft.fr/es-ES/pcsoft.us.windev/51675-mod-returns-error-when-used-sql-when-clause-51681/read.awp</link><source url="https://forum.pcsoft.fr/es-ES/pcsoft.us.windev/51675-mod-returns-error-when-used-sql-when-clause/read.awp">MOD() returns error when used in SQL WHEN clause</source><title>Re: MOD() returns error when used in SQL WHEN clause</title></item><item><author>guest</author><category>pcsoft.us.windev</category><comments>https://forum.pcsoft.fr/es-ES/pcsoft.us.windev/51675-mod-returns-error-when-used-sql-when-clause-51680/read.awp</comments><pubDate>21 Apr 2015 00:45:00 Z</pubDate><description>Sorry I overlooked as you had it in HExecuteSQLQuery(..)</description><guid isPermaLink="true">https://forum.pcsoft.fr/es-ES/pcsoft.us.windev/51675-mod-returns-error-when-used-sql-when-clause-51680/read.awp</guid><link>https://forum.pcsoft.fr/es-ES/pcsoft.us.windev/51675-mod-returns-error-when-used-sql-when-clause-51680/read.awp</link><source url="https://forum.pcsoft.fr/es-ES/pcsoft.us.windev/51675-mod-returns-error-when-used-sql-when-clause/read.awp">MOD() returns error when used in SQL WHEN clause</source><title>Re: MOD() returns error when used in SQL WHEN clause</title></item><item><author>guest</author><category>pcsoft.us.windev</category><comments>https://forum.pcsoft.fr/es-ES/pcsoft.us.windev/51675-mod-returns-error-when-used-sql-when-clause-51679/read.awp</comments><pubDate>21 Apr 2015 00:42:00 Z</pubDate><description>Gary&#13;
&#13;
I guess you miss out one line of code as below:&#13;
...&#13;
cFilterString is string = StringBuild("WHERE MOD(%1,pagecount)=0",…</description><guid isPermaLink="true">https://forum.pcsoft.fr/es-ES/pcsoft.us.windev/51675-mod-returns-error-when-used-sql-when-clause-51679/read.awp</guid><link>https://forum.pcsoft.fr/es-ES/pcsoft.us.windev/51675-mod-returns-error-when-used-sql-when-clause-51679/read.awp</link><source url="https://forum.pcsoft.fr/es-ES/pcsoft.us.windev/51675-mod-returns-error-when-used-sql-when-clause/read.awp">MOD() returns error when used in SQL WHEN clause</source><title>Re: MOD() returns error when used in SQL WHEN clause</title></item></channel></rss>
