<?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: Fetching data from SQL Table into SAS dataset in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Fetching-data-from-SQL-Table-into-SAS-dataset/m-p/596527#M171766</link>
    <description>&lt;P&gt;Can you find the idiot that created DSN with an &amp;amp; in it and get them to change it something more user friendly?&lt;/P&gt;</description>
    <pubDate>Tue, 15 Oct 2019 13:51:28 GMT</pubDate>
    <dc:creator>Tom</dc:creator>
    <dc:date>2019-10-15T13:51:28Z</dc:date>
    <item>
      <title>Fetching data from SQL Table into SAS dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Fetching-data-from-SQL-Table-into-SAS-dataset/m-p/596494#M171745</link>
      <description>&lt;P&gt;I have a SQL Server Table with special character in its name. For eg: John&amp;amp;Smith_pvt. I want to fetch data from this table into a SAS data set using PROC SQL but I'm getting error and error states "&amp;nbsp;ERROR: CLI describe error: [SAS][ODBC SQL Server Wire Protocol driver][Microsoft SQL Server]Incorrect syntax near '&amp;amp;'. : [SAS][ODBC&lt;BR /&gt;SQL Server Wire Protocol driver][Microsoft SQL Server]Statement(s) could not be prepared."&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Code I'm using:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;proc sql;&lt;BR /&gt;connect to sqlsvr (dsn="John&amp;amp;Smith_pvt" user=&amp;amp;uid pass=&amp;amp;password);&lt;BR /&gt;CREATE TABLE Product AS&lt;BR /&gt;SELECT * FROM connection to sqlsvr&lt;BR /&gt;(select&lt;BR /&gt;SUM(UNITS) AS UNITS&lt;/P&gt;&lt;P&gt;from John&amp;amp;Smith_pvt&lt;/P&gt;&lt;P&gt;);&lt;/P&gt;&lt;P&gt;quit;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Solutions I've&amp;nbsp; tried:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;1) %let tb_nm = %nrstr(John&amp;amp;Smith);, however macro variable %put &amp;amp;tb_nm is resolving correctly but it is not resolving again in my above mentioned table name.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;2) I have also tried libname options, Preserve_tab_name = Yes . eg:&amp;nbsp;libname abc sqlsvr dsn="ProductUnits" uid=&amp;amp;uid. pwd=&amp;amp;password schema= DBO; but no luck error is same as above mentioned.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Shout out to SAS expertise..!!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Could you please help me out in resolving this error?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you in advance.&lt;/P&gt;</description>
      <pubDate>Tue, 15 Oct 2019 12:23:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Fetching-data-from-SQL-Table-into-SAS-dataset/m-p/596494#M171745</guid>
      <dc:creator>NancyArora</dc:creator>
      <dc:date>2019-10-15T12:23:08Z</dc:date>
    </item>
    <item>
      <title>Re: Fetching data from SQL Table into SAS dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Fetching-data-from-SQL-Table-into-SAS-dataset/m-p/596517#M171758</link>
      <description>&lt;P&gt;From&amp;nbsp;&lt;A href="https://docs.microsoft.com/en-us/sql/odbc/microsoft/table-name-limitations?view=sql-server-ver15" target="_blank" rel="noopener"&gt;https://docs.microsoft.com/en-us/sql/odbc/microsoft/table-name-limitations?view=sql-server-ver15&lt;/A&gt;&amp;nbsp;(first result of google search for "ms sql server valid table names"):&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Table names can contain any valid characters (for example, spaces). If table names contain any characters except letters, numbers, and underscores, the name must be delimited by enclosing it in back quotes (`)&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 15 Oct 2019 13:40:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Fetching-data-from-SQL-Table-into-SAS-dataset/m-p/596517#M171758</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2019-10-15T13:40:04Z</dc:date>
    </item>
    <item>
      <title>Re: Fetching data from SQL Table into SAS dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Fetching-data-from-SQL-Table-into-SAS-dataset/m-p/596527#M171766</link>
      <description>&lt;P&gt;Can you find the idiot that created DSN with an &amp;amp; in it and get them to change it something more user friendly?&lt;/P&gt;</description>
      <pubDate>Tue, 15 Oct 2019 13:51:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Fetching-data-from-SQL-Table-into-SAS-dataset/m-p/596527#M171766</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2019-10-15T13:51:28Z</dc:date>
    </item>
  </channel>
</rss>

