Board index » delphi » Works fine in QBE, but SQL does not

Works fine in QBE, but SQL does not

Has any one experienced this, and if so, any clue?

I create a query in the QBE, it runs fine. However I then use VIEW SQL.
WITHOUT modification, I try to execute it. It DOES NOT run. It gives me
errors. Sometimes "Capability not supported", sometimes others.

This only happens with the more complex ones. And seem to occur mostly when I
have two tables, joined, and then a second line on the first table with
criteria based on a literal.

I think I still have the SQL (I can remake it if needed) and the QBE file if
anyone might be able to help.
_
We have two seasons in PA: Winter and Contsruction.

+------------------------------------------------------------+
|* Chad Z. Hower  -  phoe...@pobox.com                       |
|* Consultant - Phoenix Business Enterprises                 |
|         p...@pobox.com   -   http://pobox.com/~pbe          |
|* Principal Analyst Programmer -                            |
|         SCB Computer Technology Inc - czho...@eastman.com  |
|Physically in Church Hill, TN - Logically Not Sure          |
+------------------------------------------------------------+

Quote
>>SQUID - The ultimate database reader, and NO limits. #$737961

**Special Compile: 1.033B (Beta)
 

Re:Works fine in QBE, but SQL does not


Quote
p...@pobox.com wrote:

> Has any one experienced this, and if so, any clue?

> I create a query in the QBE, it runs fine. However I then use VIEW SQL.
> WITHOUT modification, I try to execute it. It DOES NOT run. It gives me
> errors. Sometimes "Capability not supported", sometimes others.

> This only happens with the more complex ones. And seem to occur mostly when I
> have two tables, joined, and then a second line on the first table with
> criteria based on a literal.

> I think I still have the SQL (I can remake it if needed) and the QBE file if
> anyone might be able to help.
> _
> We have two seasons in PA: Winter and Contsruction.

> +------------------------------------------------------------+
> |* Chad Z. Hower  -  phoe...@pobox.com                       |
> |* Consultant - Phoenix Business Enterprises                 |
> |         p...@pobox.com   -   http://pobox.com/~pbe          |
> |* Principal Analyst Programmer -                            |
> |         SCB Computer Technology Inc - czho...@eastman.com  |
> |Physically in Church Hill, TN - Logically Not Sure          |
> +------------------------------------------------------------+
> >>SQUID - The ultimate database reader, and NO limits. #$737961
> **Special Compile: 1.033B (Beta)

I've had similar problems going from QBE to SQL's.  One particular QBE
was had multi-table joins with multiple lines in each table.  The problem
was Paradox had written the SQL code incorrectly.

For Example the Incorrect 'Where' Statement:

WHERE
((D.Zip = '12345')
AND
(D1.Specialty = 'XXX')
AND
(D2.Code = D.Code)
AND
(D2.ID = D1.ID))
OR
((D.Zip = '12345')
AND
(D1."Sub-Specialty" = 'XXX')
AND
(D2.Code = D.Code)
AND
(D2.ID = D1.ID))

This did not work.  It had to be rewritten as:

WHERE
(D.Zip = '12345')
AND
((D1.Specialty = 'XXX') OR (D1."Sub-Specialty" = 'XXX'))
AND
(D2.Code = D.Code)
AND
(D2.ID = D1.ID)

And then it worked properly.

I wouldn't mind looking at your QBE or SQL to see if I could help.

Thanks, Dean.

Other Threads