• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 513
  • Last Modified:

sql error in sybase.

I am getting  the below error:

SQL Server cpu time: 0 ms.  SQL Server elapsed time: 0 ms.
Server Message:  Number  102, Severity  15 Incorrect syntax near '('.
Server Message:  Number  102, Severity  15 Incorrect syntax near 'x'.
Server Message:  Number  102, Severity  15 Incorrect syntax near 'y'.



SELECT x.nsdorderno, x.notetext, y.notetext
  FROM (SELECT lgeproreqaudit.nsdorderno nsdorderno,
               lgeproreqnoteaudit.notetext notetext
          FROM lgeproreqnoteaudit, lgeproreqaudit
         WHERE (UPPER (lgeproreqnoteaudit.notetext) LIKE '%PTNII:%')
           AND lgeproreqaudit.objectid = lgeproreqnoteaudit.reqaudit_objectid
           AND datepart (yy, lgeproreqaudit.createdatetime) >= 2008) x,
       (SELECT lgeproreqaudit.nsdorderno nsdorderno,
               lgeproreqnoteaudit.notetext notetext
          FROM lgeproreqnoteaudit, lgeproreqaudit
         WHERE (UPPER (lgeproreqnoteaudit.notetext) LIKE '%TPR #%')
           AND lgeproreqaudit.objectid = lgeproreqnoteaudit.reqaudit_objectid
           AND datepart (yy, lgeproreqaudit.createdatetime) >= 2008) y  WHERE x.nsdorderno = y.nsdorderno;

Open in new window

0
vishali_vishu
Asked:
vishali_vishu
  • 2
1 Solution
 
grant300Commented:
What Sybase product and version.  There are just too many to answer your question.

Do a "select @@version" and post the results.

Thanks,
Bill
0
 
vishali_vishuAuthor Commented:
Adaptive Server Enterprise/11.9.2/1031/P/Sun_svr4/OS 5.5.1/FBO/Fri Aug 14 06:26:45 1998,
0
 
grant300Commented:
Ah, just as I thought.

You are running an antique verions of Sybase.  It is 11 years old!!!!

11.9.2 does not support derived table syntax such as you are trying to use.

Now that I look at it, you are also mixing derived table syntax with correlated query syntax.  That doesn't work anyway.

Go back to basics.  This is a simple join between two tables and should be written that way.  If you were trying to drive the selection arguments forward in the query plan, you can do that with temporary tables if you must but be sure to build an index on one of them or you just trade one issue for another.

Try it as a simple join and see what you get.

Regards,
Bill
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Improve Your Query Performance Tuning

In this FREE six-day email course, you'll learn from Janis Griffin, Database Performance Evangelist. She'll teach 12 steps that you can use to optimize your queries as much as possible and see measurable results in your work. Get started today!

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now