<?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: Read SQL database files with SAS in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Read-SQL-database-files-with-SAS/m-p/209308#M51868</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Most likely you need a QUALIFIER or DATABASE specified as well.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You reference an SQL server table like so: [Server].[Database].[Schema].[Table]&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Your libname could be libname sql odbc dsn='sqldb' qualifier = xxxx schema = dbo;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you have access to SQL Server Studio that will tell you what your qualifier/database names are.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 19 Jun 2015 03:17:06 GMT</pubDate>
    <dc:creator>SASKiwi</dc:creator>
    <dc:date>2015-06-19T03:17:06Z</dc:date>
    <item>
      <title>Read SQL database files with SAS</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Read-SQL-database-files-with-SAS/m-p/209303#M51863</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN style="font-family: arial, helvetica, sans-serif; font-size: 12pt;"&gt;Hi everyone,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: arial, helvetica, sans-serif; font-size: 12pt;"&gt;I am trying to read tables stored in sql server in SAS (configuration has been set up). This is my very first time to read files in the configuration setting. I set the library by the following statement:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 12pt; font-family: 'SAS Monospace';"&gt;libname sql odbc dsn=’sqldb’;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 12pt; font-family: 'SAS Monospace';"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 12pt; font-family: 'SAS Monospace';"&gt;&lt;SPAN style="font-family: arial, helvetica, sans-serif;"&gt;Then I checked what files in the library "sql":&lt;/SPAN&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 12pt; font-family: 'SAS Monospace';"&gt;proc sql; &lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 12pt; font-family: 'SAS Monospace';"&gt; connect to odbc(dsn=’sqldb’); &lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 12pt; font-family: 'SAS Monospace';"&gt; create table test as select * from connection to odbc (ODBC::SQLTables);&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;&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; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 12pt; font-family: 'SAS Monospace';"&gt;quit;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 12pt; font-family: 'SAS Monospace';"&gt;proc contents data=test;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 12pt; font-family: 'SAS Monospace';"&gt;run;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 12pt; font-family: 'SAS Monospace';"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: arial, helvetica, sans-serif; font-size: 12pt;"&gt;I can see tables and views in the temporary file ‘test’. But when I tried to set a table based on the file ‘table1’ in the "sql" library, it says there is no such file.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 12pt;"&gt;data new;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 12pt;"&gt;&amp;nbsp; set sql.table1;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 12pt;"&gt;run;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: arial, helvetica, sans-serif; font-size: 12pt;"&gt;Did I read the file from SQL server in SAS in a right way? Please suggest!&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: arial, helvetica, sans-serif; font-size: 12pt;"&gt;Millions of thanks.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: arial, helvetica, sans-serif; font-size: 12pt;"&gt;Lizi&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 18 Jun 2015 16:11:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Read-SQL-database-files-with-SAS/m-p/209303#M51863</guid>
      <dc:creator>lizzy28</dc:creator>
      <dc:date>2015-06-18T16:11:53Z</dc:date>
    </item>
    <item>
      <title>Re: Read a file from sql server in SAS</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Read-SQL-database-files-with-SAS/m-p/209304#M51864</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Most likely you need schema=dbo in your libname statement, or the appropriate schema:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'SAS Monospace'; font-size: 16px; background-color: #ffffff;"&gt;libname sql odbc dsn=’sqldb’ schema=dbo;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'SAS Monospace'; font-size: 16px; background-color: #ffffff;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'SAS Monospace'; font-size: 16px; background-color: #ffffff;"&gt;The reason test works is that it uses pass through SQL, not your libname connection.&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 18 Jun 2015 16:30:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Read-SQL-database-files-with-SAS/m-p/209304#M51864</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2015-06-18T16:30:43Z</dc:date>
    </item>
    <item>
      <title>Re: Read a file from sql server in SAS</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Read-SQL-database-files-with-SAS/m-p/209305#M51865</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks, Reeza.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Adding &lt;SPAN style="font-family: 'SAS Monospace'; font-size: 16px; background-color: #ffffff;"&gt;schema=dbo does not make it work, although the statement "&lt;SPAN style="font-family: 'SAS Monospace'; font-size: 16px; background-color: #ffffff;"&gt;libname sql odbc dsn=’sqldb’ schema=dbo;" &lt;/SPAN&gt;worked fine.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Also, I cannot see any files in the "sql" library" through the SAS explorer. Is it the way supposed to be?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks again!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 18 Jun 2015 16:44:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Read-SQL-database-files-with-SAS/m-p/209305#M51865</guid>
      <dc:creator>lizzy28</dc:creator>
      <dc:date>2015-06-18T16:44:06Z</dc:date>
    </item>
    <item>
      <title>Re: Read SQL database files with SAS</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Read-SQL-database-files-with-SAS/m-p/209306#M51866</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Anyone has any other suggestion? Thanks.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 19 Jun 2015 02:19:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Read-SQL-database-files-with-SAS/m-p/209306#M51866</guid>
      <dc:creator>lizzy28</dc:creator>
      <dc:date>2015-06-19T02:19:25Z</dc:date>
    </item>
    <item>
      <title>Re: Read SQL database files with SAS</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Read-SQL-database-files-with-SAS/m-p/209307#M51867</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You should see them under the library. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Are your table names under 32 characters and are you sure your schema is dbo?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;There's a bunch of methods for debugging in this document:&lt;/P&gt;&lt;P&gt;&lt;A href="http://support.sas.com/techsup/technote/ts765.pdf" title="http://support.sas.com/techsup/technote/ts765.pdf"&gt;http://support.sas.com/techsup/technote/ts765.pdf&lt;/A&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 19 Jun 2015 03:01:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Read-SQL-database-files-with-SAS/m-p/209307#M51867</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2015-06-19T03:01:29Z</dc:date>
    </item>
    <item>
      <title>Re: Read SQL database files with SAS</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Read-SQL-database-files-with-SAS/m-p/209308#M51868</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Most likely you need a QUALIFIER or DATABASE specified as well.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You reference an SQL server table like so: [Server].[Database].[Schema].[Table]&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Your libname could be libname sql odbc dsn='sqldb' qualifier = xxxx schema = dbo;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you have access to SQL Server Studio that will tell you what your qualifier/database names are.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 19 Jun 2015 03:17:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Read-SQL-database-files-with-SAS/m-p/209308#M51868</guid>
      <dc:creator>SASKiwi</dc:creator>
      <dc:date>2015-06-19T03:17:06Z</dc:date>
    </item>
    <item>
      <title>Re: Read SQL database files with SAS</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Read-SQL-database-files-with-SAS/m-p/209309#M51869</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks, adding schema works. I somehow used a wrong schema name.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks a lot!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 19 Jun 2015 14:40:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Read-SQL-database-files-with-SAS/m-p/209309#M51869</guid>
      <dc:creator>lizzy28</dc:creator>
      <dc:date>2015-06-19T14:40:15Z</dc:date>
    </item>
  </channel>
</rss>

