Syntax Error?

I am getting a syntax error from this sql query.  I have been looking at it for over an hour and I just don't see the error.  Can someone take a look and let me know where the error is?


SELECT
    RM00101."CUSTNMBR", RM00101."CUSTNAME", RM00101."ADDRESS1", RM00101."ADDRESS2", RM00101."CITY", RM00101."STATE", RM00101."ZIP", RM00101."PHONE1", RM00101."FAX", RM00101."SLPRSNID",
    RM14009."PN_County",
    RM00301."SPRSNSLN",
    SOP30200."SOPTYPE", SOP30200."SOPNUMBE", SOP30200."DOCDATE",
    SOP30300."ITEMNMBR", SOP30300."ITEMDESC", SOP30300."UOFM", SOP30300."QUANTITY"
FROM
    { oj (((("PION"."dbo"."RM00101" RM00101   INNER JOIN "PION"."dbo"."RM14009" RM14009 ON RM00101."ADRSCODE" = RM14009."ADRSCODE" AND RM00101."CUSTNMBR" = RM14009."CUSTNMBR")  INNER JOIN "PION"."dbo"."SOP30200" SOP30200 ON RM14009."CUSTNMBR" = SOP30200."CUSTNMBR")  INNER JOIN "PION"."dbo"."SOP30300" SOP30300 ON SOP30200."SOPTYPE" = SOP30300."SOPTYPE" AND SOP30200."SOPNUMBE" = SOP30300."SOPNUMBE" )  INNER JOIN "PION"."dbo"."RM00301" RM00301 ON RM00101."SLPRSNID" = RM00301."SLPRSNID" )   }              
WHERE
    SOP30200."DOCDATE" >= {ts '2005-03-01 08:19:37.00'} AND
    SOP30200."DOCDATE" < {ts '2005-03-31 08:19:38.00'} AND
    SOP30200."SOPTYPE" = 2 AND
    RM00101."SLPRSNID" = '04'              
ORDER BY
    RM00101."SLPRSNID" ASC
LVL 3
PioneermfgAsked:
Who is Participating?
 
PockyMasterCommented:
well.. lets break down your query:

SELECT
    RM00101.CUSTNMBR, RM00101.CUSTNAME, RM00101.ADDRESS1, RM00101.ADDRESS2, RM00101.CITY, RM00101.STATE, RM00101.ZIP, RM00101.PHONE1, RM00101.FAX, RM00101.SLPRSNID,
    RM14009.PN_County,
    RM00301.SPRSNSLN,
    SOP30200.SOPTYPE, SOP30200.SOPNUMBE, SOP30200.DOCDATE,
    SOP30300.ITEMNMBR, SOP30300.ITEMDESC, SOP30300.UOFM, SOP30300.QUANTITY
FROM
    RM00101  
INNER JOIN RM14009 ON (RM00101.ADRSCODE = RM14009.ADRSCODE
            AND RM00101.CUSTNMBR = RM14009.CUSTNMBR)  
INNER JOIN SOP30200 ON (RM14009.CUSTNMBR = SOP30200.CUSTNMBR)  
INNER JOIN SOP30300 ON (SOP30200.SOPTYPE = SOP30300.SOPTYPE AND SOP30200.SOPNUMBE = SOP30300.SOPNUMBE )  
INNER JOIN RM00301 ON (RM00101.SLPRSNID = RM00301.SLPRSNID )
WHERE
    SOP30200.DOCDATE >= {ts '2005-03-01 08:19:37.00'} AND
    SOP30200.DOCDATE < {ts '2005-03-31 08:19:38.00'} AND
    SOP30200.SOPTYPE = 2 AND
    RM00101.SLPRSNID = '04'              
ORDER BY
    RM00101.SLPRSNID ASC

Does it work like this?
0
 
g_johnsonCommented:
what back end?  do you get any more information than "syntax error"?
0
 
PioneermfgAuthor Commented:
Yes, backend is sql 2000, line 1 '}'
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

 
PockyMasterCommented:
why are you putting the curly {} around the FROM ?
0
 
g_johnsonCommented:
i agree, get read of the brackets {}
0
 
PioneermfgAuthor Commented:
I didn't put them there, Crystal Reports did.
0
 
PioneermfgAuthor Commented:
I removed the brackets as suggested and now I get the same syntax error only now is shows the "(".
0
 
PockyMasterCommented:
Doesn't matter who did it.. but I believe they shouldnt be there .. but is it working now?
0
 
PioneermfgAuthor Commented:
I also receive a pop up window that states "error detected by database dll"
0
 
PioneermfgAuthor Commented:
No, but I receive no records nor do I receive any errors.  Let me clarify.  Before I added the rm00301.SPRSNSLN field, this query worked.
0
 
PioneermfgAuthor Commented:
PockyMaster your answer wasn't quite correct, but it did get me on the right path.  I have fixed the issue and the reports works!  Thanks!!!
0
 
PockyMasterCommented:
Good job :D
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.

All Courses

From novice to tech pro — start learning today.