Login ProductsSalesSupportDownloadsAbout |
Home » Technical Support » DBISAM Technical Support » Support Forums » DBISAM SQL » View Thread |
Messages 1 to 7 of 7 total |
Can't get HAVING to work with a parameter |
Sun, Jan 8 2006 3:30 PM | Permanent Link |
Dave M | This below listed query produces the error: "DBISAM Engine Error #11949 SQL parsing error
- Invalid expression ? found in SELECT SQL Statment at line 4, column 58." The DBISAMQuery does have the params correctly set to ftInteger with a value of 2002. It does work with a 2002 hardcoded instead of :StartYear. I am using DBISAM 4.22, Build3 and Delphi 2006. The above error happens at design time. At run time there is a parameter not found error. What's wrong? Query: ------------------------------------------------------------- SELECT cusnum, MIN(jobdate) AS firstjob FROM job GROUP BY cusnum HAVING (CAST(EXTRACT(YEAR FROM firstjob) AS INTEGER) >= :StartYear) ORDER BY cusnum |
Sun, Jan 8 2006 9:42 PM | Permanent Link |
Dave M | Ok, the previous post was a bad example. Consider the simpler query below. It produces
this error: "DBISAM Engine Error #11949 SQL parsing error - Invalid expression ? found in SELECT SQL Statment at line 4, column 22." ------------------------------------------------ SELECT cusnum, SUM(sale) AS sumsale FROM job GROUP BY cusnum HAVING (sum(sale) >= mt) ORDER BY cusnum |
Mon, Jan 9 2006 1:58 AM | Permanent Link |
"Clive" | Possibly you can not use a parameter like putting a parameter in the select,
if so then just string replace it with your value before execution. "Dave M" <mr_mensch2@hotmail.com> wrote in message news:90BEC232-6FE4-43F1-A455-DDEAA97BD9E9@news.elevatesoft.com... > This below listed query produces the error: "DBISAM Engine Error #11949 > SQL parsing error > - Invalid expression ? found in SELECT SQL Statment at line 4, column 58." > The DBISAMQuery > does have the params correctly set to ftInteger with a value of 2002. It > does work with a > 2002 hardcoded instead of :StartYear. I am using DBISAM 4.22, Build3 and > Delphi 2006. > The above error happens at design time. At run time there is a parameter > not found error. > > What's wrong? > > > Query: > ------------------------------------------------------------- > SELECT cusnum, MIN(jobdate) AS firstjob > FROM job > GROUP BY cusnum > HAVING (CAST(EXTRACT(YEAR FROM firstjob) AS INTEGER) >= :StartYear) > ORDER BY cusnum > |
Mon, Jan 9 2006 11:30 AM | Permanent Link |
Tim Young [Elevate Software] Elevate Software, Inc. timyoung@elevatesoft.com | Dave,
<< This below listed query produces the error: "DBISAM Engine Error #11949 SQL parsing error - Invalid expression ? found in SELECT SQL Statment at line 4, column 58." The DBISAMQuery does have the params correctly set to ftInteger with a value of 2002. It does work with a 2002 hardcoded instead of :StartYear. I am using DBISAM 4.22, Build3 and Delphi 2006. The above error happens at design time. At run time there is a parameter not found error. >> You can't use parameters in the HAVING clause. Only in the WHERE clause. -- Tim Young Elevate Software www.elevatesoft.com |
Mon, Jan 9 2006 12:16 PM | Permanent Link |
"Ole Willy Tuv" | Tim,
<< You can't use parameters in the HAVING clause. Only in the WHERE clause. >> Two questions: 1) What's the reason for this limitation ? 2) Will V5 have the same limitation ? Ole |
Mon, Jan 9 2006 4:33 PM | Permanent Link |
Dave M | "Clive" <dd@dddd.com> wrote:
Possibly you can not use a parameter like putting a parameter in the select, if so then just string replace it with your value before execution. --------------------------------------------------------- Good idea. If I have to, I will. |
Tue, Jan 10 2006 7:51 PM | Permanent Link |
Tim Young [Elevate Software] Elevate Software, Inc. timyoung@elevatesoft.com | Ole,
<< 1) What's the reason for this limitation ? >> It's arbitrary - it could be done and there's no technical limitation since a parameter is simply a constant value. << 2) Will V5 have the same limitation ? >> At least initially. I'll have to see what kind of time is available to fit in such a change. -- Tim Young Elevate Software www.elevatesoft.com |
This web page was last updated on Saturday, May 4, 2024 at 12:54 AM | Privacy PolicySite Map © 2024 Elevate Software, Inc. All Rights Reserved Questions or comments ? E-mail us at info@elevatesoft.com |