<?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 when using restricted SQL keyword (SQL Server 13.0.4422.0) in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/ERROR-when-using-restricted-SQL-keyword-SQL-Server-13-0-4422-0/m-p/368959#M88007</link>
    <description>&lt;P&gt;Please note adding the modifying the sql didn;t work.&amp;nbsp; I was getting the same error&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Maybe try&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;&amp;nbsp; select distinct constraint as CONS&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif"&gt;or &lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;FONT face="courier new,courier"&gt; select distinct 'constraint'n as CONS &lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;The explicit passhtrough worked but I had to pull back the whole table (luckily, not a big table)&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;proc sql; &lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;&amp;nbsp;connect using warehse;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;&amp;nbsp;select * from connection to warehse (select distinct constraint as CONS..);&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 20 Jun 2017 21:39:58 GMT</pubDate>
    <dc:creator>RichM</dc:creator>
    <dc:date>2017-06-20T21:39:58Z</dc:date>
    <item>
      <title>ERROR when using restricted SQL keyword (SQL Server 13.0.4422.0)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/ERROR-when-using-restricted-SQL-keyword-SQL-Server-13-0-4422-0/m-p/368480#M87889</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm getting the following error when I run this SAS code.&amp;nbsp; The backend database is&amp;nbsp;SQL Server (13.0.4422.0) connecting via ODBC.&amp;nbsp; They used a restricted keyword as a column name, which is causing the error.&amp;nbsp; I'm not sure the implications of changing the column name.&amp;nbsp; Is there a way to modify my sas so I can keep the keyword column&amp;nbsp;name.&amp;nbsp; BTW: This runs under 9.2.&amp;nbsp; I'm porting the code to 9.4. Also, I tried enclosing constraint with backets [constraint]&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;proc sql noprint;&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;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;select distinct constraint into :PBD_binary_constraints separated by " " from warehse.cmmn_opt_assetbounds&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;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; where event_multiplier = 0 or event_multiplier = .;&lt;/P&gt;&lt;P&gt;quit;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;ERROR: CLI describe error: [DataDirect][ODBC SQL Server Wire Protocol driver][Microsoft SQL Server]Incorrect syntax near the&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; keyword 'constraint'.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 19 Jun 2017 20:28:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/ERROR-when-using-restricted-SQL-keyword-SQL-Server-13-0-4422-0/m-p/368480#M87889</guid>
      <dc:creator>RichM</dc:creator>
      <dc:date>2017-06-19T20:28:10Z</dc:date>
    </item>
    <item>
      <title>Re: ERROR when using restricted SQL keyword (SQL Server 13.0.4422.0)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/ERROR-when-using-restricted-SQL-keyword-SQL-Server-13-0-4422-0/m-p/368547#M87907</link>
      <description>&lt;P&gt;I am not very sure about this. but try&lt;/P&gt;
&lt;P&gt;options&amp;nbsp;&lt;SPAN&gt;NODBIDIRECTEXEC;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;You can create a sas table in explicit pass through with a new column name and then try the query below with SAS table&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 20 Jun 2017 01:01:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/ERROR-when-using-restricted-SQL-keyword-SQL-Server-13-0-4422-0/m-p/368547#M87907</guid>
      <dc:creator>kiranv_</dc:creator>
      <dc:date>2017-06-20T01:01:51Z</dc:date>
    </item>
    <item>
      <title>Re: ERROR when using restricted SQL keyword (SQL Server 13.0.4422.0)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/ERROR-when-using-restricted-SQL-keyword-SQL-Server-13-0-4422-0/m-p/368566#M87916</link>
      <description>&lt;P&gt;It's Microsoft's own ODBC driver that chokes it seems.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Maybe try&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier"&gt;&amp;nbsp; select distinct constraint as CONS&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif"&gt;or &lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;FONT face="courier new,courier"&gt; select distinct 'constraint'n as CONS &lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Otherwise explicit passhtrough should work:&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier"&gt;proc sql; &lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier"&gt;&amp;nbsp;connect using warehse;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier"&gt;&amp;nbsp;select * from connection to warehse (select distinct constraint as CONS..);&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 20 Jun 2017 02:51:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/ERROR-when-using-restricted-SQL-keyword-SQL-Server-13-0-4422-0/m-p/368566#M87916</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2017-06-20T02:51:14Z</dc:date>
    </item>
    <item>
      <title>Re: ERROR when using restricted SQL keyword (SQL Server 13.0.4422.0)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/ERROR-when-using-restricted-SQL-keyword-SQL-Server-13-0-4422-0/m-p/368582#M87919</link>
      <description>&lt;P&gt;So someone used a variable name in MS SQL server that is invalid there and causes the MS ODBC connection to crash.&lt;/P&gt;
&lt;P&gt;The correct remedy is to not use the keyword "constraint" as a variable name, which is sound programming practice in the first place.&lt;/P&gt;
&lt;P&gt;Have the mistake fixed on the SQL server side in the database.&lt;/P&gt;</description>
      <pubDate>Tue, 20 Jun 2017 06:16:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/ERROR-when-using-restricted-SQL-keyword-SQL-Server-13-0-4422-0/m-p/368582#M87919</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2017-06-20T06:16:46Z</dc:date>
    </item>
    <item>
      <title>Re: ERROR when using restricted SQL keyword (SQL Server 13.0.4422.0)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/ERROR-when-using-restricted-SQL-keyword-SQL-Server-13-0-4422-0/m-p/368959#M88007</link>
      <description>&lt;P&gt;Please note adding the modifying the sql didn;t work.&amp;nbsp; I was getting the same error&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Maybe try&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;&amp;nbsp; select distinct constraint as CONS&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif"&gt;or &lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;FONT face="courier new,courier"&gt; select distinct 'constraint'n as CONS &lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;The explicit passhtrough worked but I had to pull back the whole table (luckily, not a big table)&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;proc sql; &lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;&amp;nbsp;connect using warehse;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;&amp;nbsp;select * from connection to warehse (select distinct constraint as CONS..);&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 20 Jun 2017 21:39:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/ERROR-when-using-restricted-SQL-keyword-SQL-Server-13-0-4422-0/m-p/368959#M88007</guid>
      <dc:creator>RichM</dc:creator>
      <dc:date>2017-06-20T21:39:58Z</dc:date>
    </item>
  </channel>
</rss>

