[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 507
  • 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

Featured Post

Upgrade your Question Security!

Add Premium security features to your question to ensure its privacy or anonymity. Learn more about your ability to control Question Security today.

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