Error nanodbc/nanodbc.cpp:1655

I have a problem with running SQL query from R-Studo code.
On another machine everything works perfectly. I just try to run the same code from new computer
(RStudio version 2022.07.2)

IMP_Sales <- dbGetQuery(ImperialODBC, "Select SBLOC,SBCUST,SBSMNO,SBITEM,SBTYPE,SBINDT,SBPHYP,SBQSHP,SBEPRC,SBPRIC,SBICST,SBINV,SBCOSTPC,SBUM,SASHIP 
+                              From R50FILES.VSADETL 
+                              JOIN R50FILES.VSAHEAD 
+                              ON SBCMP=SACMP and SBORD=SAORD and SABOCD=SBBOCD 
+                              Where SBINV<>999999999 and SBPCOD <> 'LS' and SBCMP = 1 and SBPHYP between 202201 and 202212 and SBITEM <> ''")

and get the following error message:

Error: nanodbc/nanodbc.cpp:1655: HY000:                                  
<SQL> 'Select SBLOC,SBCUST,SBSMNO,SBITEM,SBTYPE,SBINDT,SBPHYP,SBQSHP,SBEPRC,SBPRIC,SBICST,SBINV,SBCOSTPC,SBUM,SASHIP 
                             From R50FILES.VSADETL 
                             JOIN R50FILES.VSAHEAD 
                             ON SBCMP=SACMP and SBORD=SAORD and SABOCD=SBBOCD 
                             Where SBINV<>999999999 and SBPCOD <> 'LS' and SBCMP = 1 and SBPHYP between 202201 
                             and 202212 and SBITEM <> '''

The dbConnect works without any problem

Please advice

If you are on MS Server see this post for possible problem.

This topic was automatically closed 42 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.