Works fine with isql but powerbuilder datawindow gives error

Posted on 1999-12-04
Medium Priority
Last Modified: 2010-08-05
This script works fine when i run it with isql and gives me result
but when i run this script on powerbuilder database painter or datawindow it give error

"Incorrect syntax near '2'.
Select ..................................

The select is

SELECT a.comments,  
cc_paid = ( SELECT sum(payment_amount)
                       FROM Invoice,   Payments
                      WHERE ( Invoice.vendor_no = Payments.vendor_no ) and  
                            ( Invoice.invoice_number = Payments.invoice_number ) and  
                            ( Invoice.order_number = Payments.order_number )  
                   GROUP BY Invoice.order_number, Payments.fund_key  
                     HAVING ( Invoice.order_number = Encumbered_Funds.order_number ) and
                            ( Payments.fund_key = a.fund_key))
    FROM Encumbered_Funds  a
   WHERE a.order_number = "111"
ORDER BY Encumbered_Funds.fund_key ASC  

The whole select statement is repeated in the eroor message.
Please do help me.I have see this problem when i use a nested query in my  slect statment.I cannot change the select statement for the datawindow.Only powerbuilder gives the problem
Question by:ajith_29

Expert Comment

ID: 2256104
It happens to with me sometimes ..Just try to leave space at the end of each line in the select statement.It might seem silly but it usually works.

Author Comment

ID: 2257376
I tried it did not work

Expert Comment

ID: 2262167
You may have done this, but it is not in your sample:  put a semi-colon at the end

and ... begin each line with a space or tab (same as rejected answer, but insures there are whitespaces)

and finally as a last result ...  this absolutely will work

create a database view and select from the view in your datawindow

Accepted Solution

jkotek earned 200 total points
ID: 2280126
If you use a Sybase native db interface (SYC, SYD or SYJ drivers), try to use the 'ModifySyntax=0' DBParm.

When executing a query, PowerBuilder queries Sybase metadata and some times modifies a where clausule to get better performance. The 'ModifySyntax' prevents such behaviour and might help you.

Featured Post

The 14th Annual Expert Award Winners

The results are in! Meet the top members of our 2017 Expert Awards. Congratulations to all who qualified!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

You do not need to be a security expert to make the RIGHT security. You just need some 3D guidance, to help lay out an action plan to secure your business operations. It does not happen overnight. You just need to start now and do the first thin…
Let us take a look at the scenario, you have a database that is corrupt and you run the ESEUTIL command only to find you are unable to repair it. How do you now get the data back?
Kernel Data Recovery is a renowned Data Recovery solution provider which offers wide range of softwares for both enterprise and home users with its cost-effective solutions. Let's have a quick overview of the journey and data recovery tools range he…
Enter Foreign and Special Characters Enter characters you can't find on a keyboard using its ASCII code ... and learn how to make a handy reference for yourself using Excel ~ Use these codes in any Windows application! ... whether it is a Micr…
Suggested Courses

601 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question