<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Error in Pass through query (ODBC) in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Error-in-Pass-through-query-ODBC/m-p/135788#M36679</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Dreamer,&lt;/P&gt;&lt;P&gt;can you give this a try?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc sql;&lt;BR /&gt; connect to odbc as mycon&amp;nbsp; (datasrc=xxxx user=xxxx password=xxxxx);&lt;BR /&gt; select * from connection to mycon&lt;/P&gt;&lt;P&gt; (select distinct &lt;BR /&gt;&amp;nbsp; meme.meme_last_name, &lt;BR /&gt;&amp;nbsp; meme.meme_first_name,&lt;BR /&gt;&amp;nbsp; max(mepe.cscs_id) as classid&lt;BR /&gt;&amp;nbsp; from cmc_meme_member as meme, meme_ck as mepe&lt;BR /&gt;&amp;nbsp;&amp;nbsp; where meme.meme_ck = mepe.meme_ck and meme.meme_rel &amp;lt;&amp;gt; 'O' &lt;BR /&gt;&amp;nbsp; group by meme.meme_ck);&lt;BR /&gt; disconnect from mycon;&lt;BR /&gt;quit;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 08 Sep 2014 21:01:17 GMT</pubDate>
    <dc:creator>Hima</dc:creator>
    <dc:date>2014-09-08T21:01:17Z</dc:date>
    <item>
      <title>Error in Pass through query (ODBC)</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Error-in-Pass-through-query-ODBC/m-p/135787#M36678</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN style="color: #000000;"&gt;Hi&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000;"&gt;I am trying to pull data from Sybase using pass through query via ODBC.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000;"&gt;Following is the code that I'm trying:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;Proc Sql;&lt;/P&gt;&lt;P&gt;Connect to odbc as mycon&amp;nbsp; (datasrc=XXXX user=XXXX password=XXXXX);&lt;/P&gt;&lt;P&gt;select * from connection to mycon&lt;/P&gt;&lt;P&gt;(SELECT DISTINCT&lt;/P&gt;&lt;P&gt;MEME.MEME_LAST_NAME,&lt;/P&gt;&lt;P&gt;MEME.MEME_FIRST_NAME,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; (SELECT MAX(MEPE.CSCS_ID)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; FROM CMC_MEPE_PRCS_ELIG as MEPE&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="text-decoration: underline;"&gt;&lt;STRONG&gt;WHERE&amp;nbsp; MEME.MEME_CK = MEPE.MEME_CK&lt;/STRONG&gt;&lt;/SPAN&gt; ) as ClassID&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;FROM CMC_MEME_MEMBER as MEME&lt;/P&gt;&lt;P&gt;WHERE&amp;nbsp; MEME.MEME_REL &amp;lt;&amp;gt; 'O'&lt;/P&gt;&lt;P&gt;);&lt;/P&gt;&lt;P&gt;disconnect from mycon;&lt;/P&gt;&lt;P&gt;quit;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But I'm getting following error:&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #ff0000;"&gt;ERROR: CLI describe error: [Sybase][ODBC Driver][Adaptive Server Enterprise]Incorrect syntax near '2'.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000;"&gt;I'll not get error if I remove inner "WHERE" clause highlighted in the code. But doesn't matter what condition I give there, I'll get the same error.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000;"&gt;But I need that where clause to filter records for processing.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000;"&gt;Do we have any solution to avoid this error?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000;"&gt;Thanks&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 08 Sep 2014 20:34:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Error-in-Pass-through-query-ODBC/m-p/135787#M36678</guid>
      <dc:creator>Dreamer</dc:creator>
      <dc:date>2014-09-08T20:34:51Z</dc:date>
    </item>
    <item>
      <title>Re: Error in Pass through query (ODBC)</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Error-in-Pass-through-query-ODBC/m-p/135788#M36679</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Dreamer,&lt;/P&gt;&lt;P&gt;can you give this a try?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc sql;&lt;BR /&gt; connect to odbc as mycon&amp;nbsp; (datasrc=xxxx user=xxxx password=xxxxx);&lt;BR /&gt; select * from connection to mycon&lt;/P&gt;&lt;P&gt; (select distinct &lt;BR /&gt;&amp;nbsp; meme.meme_last_name, &lt;BR /&gt;&amp;nbsp; meme.meme_first_name,&lt;BR /&gt;&amp;nbsp; max(mepe.cscs_id) as classid&lt;BR /&gt;&amp;nbsp; from cmc_meme_member as meme, meme_ck as mepe&lt;BR /&gt;&amp;nbsp;&amp;nbsp; where meme.meme_ck = mepe.meme_ck and meme.meme_rel &amp;lt;&amp;gt; 'O' &lt;BR /&gt;&amp;nbsp; group by meme.meme_ck);&lt;BR /&gt; disconnect from mycon;&lt;BR /&gt;quit;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 08 Sep 2014 21:01:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Error-in-Pass-through-query-ODBC/m-p/135788#M36679</guid>
      <dc:creator>Hima</dc:creator>
      <dc:date>2014-09-08T21:01:17Z</dc:date>
    </item>
    <item>
      <title>Re: Error in Pass through query (ODBC)</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Error-in-Pass-through-query-ODBC/m-p/135789#M36680</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks Himi but I didn't get expected result and it took a long time.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Btw my original sql executes perfectly on other sql tools like Winsql and even on excel using odbc connection. This means SQL is perfect for ODBC.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Also it runs perfectly in SAS EG if I remove the inner where clause.&lt;/P&gt;&lt;P&gt;I'm not sure if I'm missing anything here!!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 08 Sep 2014 21:32:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Error-in-Pass-through-query-ODBC/m-p/135789#M36680</guid>
      <dc:creator>Dreamer</dc:creator>
      <dc:date>2014-09-08T21:32:56Z</dc:date>
    </item>
    <item>
      <title>Re: Error in Pass through query (ODBC)</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Error-in-Pass-through-query-ODBC/m-p/135790#M36681</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I would try instead of MEME.MEME_CK in the subquery the full name CMC_MEME_MEMBER.Meme_CK in case there is some timing issue with where/when the allias MEME is valid in the pass through.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 08 Sep 2014 22:17:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Error-in-Pass-through-query-ODBC/m-p/135790#M36681</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2014-09-08T22:17:09Z</dc:date>
    </item>
    <item>
      <title>Re: Error in Pass through query (ODBC)</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Error-in-Pass-through-query-ODBC/m-p/135791#M36682</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Am I missing something here? Isn't this a Sybase SQL issue, not a SAS SQL pass-thru issue? SAS sends the entire query to the source DBMS for execution, I'm having a hard time believe that SAS will infect this code different than other SQL tools.&lt;/P&gt;&lt;P&gt;Does your "original SQL" includes the troublesome sub-query?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 09 Sep 2014 07:02:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Error-in-Pass-through-query-ODBC/m-p/135791#M36682</guid>
      <dc:creator>LinusH</dc:creator>
      <dc:date>2014-09-09T07:02:33Z</dc:date>
    </item>
    <item>
      <title>Re: Error in Pass through query (ODBC)</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Error-in-Pass-through-query-ODBC/m-p/135792#M36683</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;use the sastrace option to debug what is happening. &lt;A href="http://support.sas.com/documentation/cdl/en/acreldb/67473/HTML/default/viewer.htm#n0732u1mr57ycrn1urf24gzo38sc.htm" title="http://support.sas.com/documentation/cdl/en/acreldb/67473/HTML/default/viewer.htm#n0732u1mr57ycrn1urf24gzo38sc.htm"&gt;SAS/ACCESS(R) 9.4 for Relational Databases: Reference, Fifth Edition&lt;/A&gt;&lt;/P&gt;&lt;P&gt;SAS is using ANSI-Sql&amp;nbsp; the esparanto for RDBMS systems, none of them is the same all are using dialects.&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You are using the ODDC driver &lt;A href="http://support.sas.com/documentation/cdl/en/acreldb/67473/HTML/default/viewer.htm#p1f29m86u65hken1deqcybowtgma.htm" title="http://support.sas.com/documentation/cdl/en/acreldb/67473/HTML/default/viewer.htm#p1f29m86u65hken1deqcybowtgma.htm"&gt;SAS/ACCESS(R) 9.4 for Relational Databases: Reference, Fifth Edition&lt;/A&gt; Is this one is running on your server side? Than the odbc driver at hat side could have issues not being the same as on your desktop.&amp;nbsp;&amp;nbsp; &lt;BR /&gt;I was searching for some differences with using an execute statement sql explicit pass through and your approach. They are sometimes behaving different, could not get my fingers on that.&lt;BR /&gt;&lt;A href="http://support.sas.com/documentation/cdl/en/acreldb/67473/HTML/default/viewer.htm#n0pj5uu3i328pmn1fackclh2xnd9.htm" title="http://support.sas.com/documentation/cdl/en/acreldb/67473/HTML/default/viewer.htm#n0pj5uu3i328pmn1fackclh2xnd9.htm"&gt;SAS/ACCESS(R) 9.4 for Relational Databases: Reference, Fifth Edition&lt;/A&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 09 Sep 2014 08:22:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Error-in-Pass-through-query-ODBC/m-p/135792#M36683</guid>
      <dc:creator>jakarman</dc:creator>
      <dc:date>2014-09-09T08:22:50Z</dc:date>
    </item>
    <item>
      <title>Re: Error in Pass through query (ODBC)</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Error-in-Pass-through-query-ODBC/m-p/135793#M36684</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;SASTRACE won't probably get you any more info when using explicit pass-thru: what you type is what you get...&lt;img id="smileywink" class="emoticon emoticon-smileywink" src="https://communities.sas.com/i/smilies/16x16_smiley-wink.png" alt="Smiley Wink" title="Smiley Wink" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 09 Sep 2014 11:39:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Error-in-Pass-through-query-ODBC/m-p/135793#M36684</guid>
      <dc:creator>LinusH</dc:creator>
      <dc:date>2014-09-09T11:39:35Z</dc:date>
    </item>
    <item>
      <title>Re: Error in Pass through query (ODBC)</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Error-in-Pass-through-query-ODBC/m-p/135794#M36685</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Yep you are correct explicit pass through should not get any inference by SAS. Seen this with TD is not exactly the same. The execute interface (link in updated post) did behave different. &lt;BR /&gt;The chunks send to the RDBMS are better in control needing the commits cleanups or whatever. Several other options in SAS did some automation on that. Automation on some things you do not control is an contradiction.&amp;nbsp; &lt;/P&gt;&lt;P&gt;As said I couldn't get my finger why those differences were there. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 09 Sep 2014 12:00:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Error-in-Pass-through-query-ODBC/m-p/135794#M36685</guid>
      <dc:creator>jakarman</dc:creator>
      <dc:date>2014-09-09T12:00:16Z</dc:date>
    </item>
    <item>
      <title>Re: Error in Pass through query (ODBC)</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Error-in-Pass-through-query-ODBC/m-p/135795#M36686</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I totally forgot to update this thread.&lt;/P&gt;&lt;P&gt;I didn't get any good solution for this problem. But I did a work around.&lt;/P&gt;&lt;P&gt;I took out all the nested SQLs. Created temporary tables from results of those queries and then merged those temporary tables to get all variables in my final result.&lt;/P&gt;&lt;P&gt;I know this is not a good solution but I couldn't get any better and only good thing here is that it worked for me. I got output what I wanted!! &lt;img id="smileyhappy" class="emoticon emoticon-smileyhappy" src="https://communities.sas.com/i/smilies/16x16_smiley-happy.png" alt="Smiley Happy" title="Smiley Happy" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 31 Oct 2014 18:28:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Error-in-Pass-through-query-ODBC/m-p/135795#M36686</guid>
      <dc:creator>Dreamer</dc:creator>
      <dc:date>2014-10-31T18:28:57Z</dc:date>
    </item>
    <item>
      <title>Re: Error in Pass through query (ODBC)</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Error-in-Pass-through-query-ODBC/m-p/135796#M36687</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Dreamer,&amp;nbsp; Now you are mentioning those nested queries and temporary results. How big are those intermediate tables. Sometimes limits have been set (like max 10.000 rows) causing unpredictabel result and errors. The best thing, you have your results.&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 31 Oct 2014 18:49:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Error-in-Pass-through-query-ODBC/m-p/135796#M36687</guid>
      <dc:creator>jakarman</dc:creator>
      <dc:date>2014-10-31T18:49:21Z</dc:date>
    </item>
  </channel>
</rss>

