<?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: How to use different SQL Server databases in SAS? in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/How-to-use-different-SQL-Server-databases-in-SAS/m-p/521430#M4201</link>
    <description>&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You tracked me down. SAS does not give any erros messages. I thought that it should give an error message if my schema database doesn't exist.&amp;nbsp; I tried this in Oracle:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;libname&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; o &lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;oracle&lt;/FONT&gt; &lt;FONT color="#0000ff" face="Courier New" size="3"&gt;user&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;=&amp;amp;user &lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;pw&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;=&amp;amp;pw &lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;path&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;=some_path &lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;dbprompt&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;=no &lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;schema&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;=&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;"not_existing_database"&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;No error messages in log though there is a typo in the database name. Why? Database queries to "existing_database" don't work, of course.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;libname&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; o &lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;oracle&lt;/FONT&gt; &lt;FONT color="#0000ff" face="Courier New" size="3"&gt;user&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;=&amp;amp;user &lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;pw&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;=&amp;amp;pw &lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;path&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;=some_path &lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;dbprompt&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;=no &lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;schema&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;=&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;"existing_database"&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;No error messages in log. Database queries to "existing_database" work.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In SQL Server the following statement does not point libname SQL to "existing_database" and database queries to "existing_database" don't work. The actual LIBNAME statement does not give any error messages. The connection to the server succeeds, however.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;LIBNAME&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; SQL &lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;ODBC&lt;/FONT&gt; &lt;FONT color="#0000ff" face="Courier New" size="3"&gt;DSN&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;=&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;"server"&lt;/FONT&gt; &lt;FONT color="#0000ff" face="Courier New" size="3"&gt;user&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;=&amp;amp;user &lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;pw&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;=&amp;amp;pw &lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;schema&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;=existing_database;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;35 LIBNAME SQL ODBC DSN="server" user=user pw=pw schema=existing_database;&lt;BR /&gt;NOTE: Libref SQL was successfully assigned as follows:&lt;BR /&gt;Engine: ODBC&lt;BR /&gt;Physical Name: existing_database&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I couldn't get&amp;nbsp;schema definition to function.&amp;nbsp; I just must create a new data source (DSN)&amp;nbsp;for every database by&amp;nbsp;using Microsoft ODBC Administrator.&amp;nbsp; It is not very handy while then I have many SQL Server&amp;nbsp;drivers for one server connection.&amp;nbsp;I thought that I could create only one data source in ODBC Administrator, define default database and use SAS schema definition&amp;nbsp;to make queries to other databases.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;</description>
    <pubDate>Mon, 17 Dec 2018 13:48:16 GMT</pubDate>
    <dc:creator>pietinma</dc:creator>
    <dc:date>2018-12-17T13:48:16Z</dc:date>
    <item>
      <title>How to use different SQL Server databases in SAS?</title>
      <link>https://communities.sas.com/t5/New-SAS-User/How-to-use-different-SQL-Server-databases-in-SAS/m-p/521131#M4147</link>
      <description>&lt;P&gt;I use different databases in my SAS scripts. In Oracle I can define a&amp;nbsp;database using a&amp;nbsp;schema statement:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;libname&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; o1 &lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;oracle&lt;/FONT&gt; &lt;FONT color="#0000ff" face="Courier New" size="3"&gt;user&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;=&amp;amp;user &lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;pw&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;=&amp;amp;pw &lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;path&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;=&amp;amp;path &lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;dbprompt&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;=no &lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;schema&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;=&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;"db1"&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;&lt;FONT color="#0000ff" face="Courier New"&gt;libname&lt;/FONT&gt; o2 &lt;FONT color="#0000ff" face="Courier New" size="3"&gt;oracle&lt;/FONT&gt; &lt;FONT color="#0000ff" face="Courier New" size="3"&gt;user&lt;/FONT&gt;=&amp;amp;user &lt;FONT color="#0000ff" face="Courier New" size="3"&gt;pw&lt;/FONT&gt;=&amp;amp;pw &lt;FONT color="#0000ff" face="Courier New" size="3"&gt;path&lt;/FONT&gt;=&amp;amp;path &lt;FONT color="#0000ff" face="Courier New" size="3"&gt;dbprompt&lt;/FONT&gt;=no &lt;FONT color="#0000ff" face="Courier New" size="3"&gt;schema&lt;/FONT&gt;=&lt;FONT color="#800080" face="Courier New" size="3"&gt;"db2"&lt;/FONT&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How can I do the same in SQL Server? How do I define, that I don't want to use master but db instead? This does not work:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;LIBNAME&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; SQL &lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;ODBC&lt;/FONT&gt; &lt;FONT color="#0000ff" face="Courier New" size="3"&gt;DSN&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;=&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;"DSN"&lt;/FONT&gt; &lt;FONT color="#0000ff" face="Courier New" size="3"&gt;user&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;=&amp;amp;user &lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;pw&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;=&amp;amp;pw schema="db";&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 13 Dec 2018 13:26:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/How-to-use-different-SQL-Server-databases-in-SAS/m-p/521131#M4147</guid>
      <dc:creator>pietinma</dc:creator>
      <dc:date>2018-12-13T13:26:36Z</dc:date>
    </item>
    <item>
      <title>Re: How to use different SQL Server databases in SAS?</title>
      <link>https://communities.sas.com/t5/New-SAS-User/How-to-use-different-SQL-Server-databases-in-SAS/m-p/521138#M4148</link>
      <description>&lt;P&gt;Define "does not work". There are a gazillion of "don't works", so how should we know which one hits you?&lt;/P&gt;
&lt;P&gt;Read the log (Maxim 2), and post it here.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Also do a google search (Maxim 6) for the text of an ERROR or WARNING message, if you get one.&lt;/P&gt;</description>
      <pubDate>Thu, 13 Dec 2018 13:50:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/How-to-use-different-SQL-Server-databases-in-SAS/m-p/521138#M4148</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2018-12-13T13:50:30Z</dc:date>
    </item>
    <item>
      <title>Re: How to use different SQL Server databases in SAS?</title>
      <link>https://communities.sas.com/t5/New-SAS-User/How-to-use-different-SQL-Server-databases-in-SAS/m-p/521178#M4155</link>
      <description>&lt;P&gt;The idea is right, most likely the syntax is wrong. So you know the dsn works, you've tested that portion already?&lt;/P&gt;
&lt;P&gt;I don't think the dsn name needs to be in quotes. This also assumes you're not on a server, otherwise that's a different issue.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This is my connection string to a DB2 instance, something like this should work for you as well.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;libname home odbc schema="dbo" noprompt="server=SERVERNAME,PORT#;DRIVER=SQL Server;Trusted_Connection=yes;database=databasename";

&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 13 Dec 2018 16:15:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/How-to-use-different-SQL-Server-databases-in-SAS/m-p/521178#M4155</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2018-12-13T16:15:13Z</dc:date>
    </item>
    <item>
      <title>Re: How to use different SQL Server databases in SAS?</title>
      <link>https://communities.sas.com/t5/New-SAS-User/How-to-use-different-SQL-Server-databases-in-SAS/m-p/521430#M4201</link>
      <description>&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You tracked me down. SAS does not give any erros messages. I thought that it should give an error message if my schema database doesn't exist.&amp;nbsp; I tried this in Oracle:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;libname&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; o &lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;oracle&lt;/FONT&gt; &lt;FONT color="#0000ff" face="Courier New" size="3"&gt;user&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;=&amp;amp;user &lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;pw&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;=&amp;amp;pw &lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;path&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;=some_path &lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;dbprompt&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;=no &lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;schema&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;=&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;"not_existing_database"&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;No error messages in log though there is a typo in the database name. Why? Database queries to "existing_database" don't work, of course.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;libname&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; o &lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;oracle&lt;/FONT&gt; &lt;FONT color="#0000ff" face="Courier New" size="3"&gt;user&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;=&amp;amp;user &lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;pw&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;=&amp;amp;pw &lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;path&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;=some_path &lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;dbprompt&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;=no &lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;schema&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;=&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;"existing_database"&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;No error messages in log. Database queries to "existing_database" work.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In SQL Server the following statement does not point libname SQL to "existing_database" and database queries to "existing_database" don't work. The actual LIBNAME statement does not give any error messages. The connection to the server succeeds, however.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;LIBNAME&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; SQL &lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;ODBC&lt;/FONT&gt; &lt;FONT color="#0000ff" face="Courier New" size="3"&gt;DSN&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;=&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;"server"&lt;/FONT&gt; &lt;FONT color="#0000ff" face="Courier New" size="3"&gt;user&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;=&amp;amp;user &lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;pw&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;=&amp;amp;pw &lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;schema&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;=existing_database;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;35 LIBNAME SQL ODBC DSN="server" user=user pw=pw schema=existing_database;&lt;BR /&gt;NOTE: Libref SQL was successfully assigned as follows:&lt;BR /&gt;Engine: ODBC&lt;BR /&gt;Physical Name: existing_database&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I couldn't get&amp;nbsp;schema definition to function.&amp;nbsp; I just must create a new data source (DSN)&amp;nbsp;for every database by&amp;nbsp;using Microsoft ODBC Administrator.&amp;nbsp; It is not very handy while then I have many SQL Server&amp;nbsp;drivers for one server connection.&amp;nbsp;I thought that I could create only one data source in ODBC Administrator, define default database and use SAS schema definition&amp;nbsp;to make queries to other databases.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 17 Dec 2018 13:48:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/How-to-use-different-SQL-Server-databases-in-SAS/m-p/521430#M4201</guid>
      <dc:creator>pietinma</dc:creator>
      <dc:date>2018-12-17T13:48:16Z</dc:date>
    </item>
  </channel>
</rss>

