<?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: Connection String For SAS EG to SQL Server using Windows Auth in SAS Enterprise Guide</title>
    <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Connection-String-For-SAS-EG-to-SQL-Server-using-Windows-Auth/m-p/889546#M43480</link>
    <description>&lt;P&gt;Here is what I have used directly:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;libname ref '\\ABC.corp\dfsroot\BSC\SAS';&lt;BR /&gt;libname SQLREF ODBC NOPROMPT="server=SVDSQLASASREFERENCED;driver=ODBC Driver 13 for SQL Server;database=DB;trusted_connection=yes" STRINGDATES=NO IGNORE_READ_ONLY_COLUMNS=YES SCHEMA=DBO;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data SQLREF.Factor;&lt;BR /&gt;set ref.Factor ;&lt;BR /&gt;run;&lt;/P&gt;</description>
    <pubDate>Wed, 16 Aug 2023 19:12:32 GMT</pubDate>
    <dc:creator>AlanC</dc:creator>
    <dc:date>2023-08-16T19:12:32Z</dc:date>
    <item>
      <title>Connection String For SAS EG to SQL Server using Windows Auth</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Connection-String-For-SAS-EG-to-SQL-Server-using-Windows-Auth/m-p/889532#M43475</link>
      <description>&lt;P&gt;Hi Everyone,&lt;/P&gt;
&lt;P&gt;I'm trying to establish a connection to Microsoft SQL server from SAS EG using windows authentication.&lt;/P&gt;
&lt;P&gt;Could anyone please let me know if that's possible, then how it can be achieved, like the connection string &amp;amp; backend config prerequisites.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;SAS Management Console: 9.4 M2&lt;/P&gt;
&lt;P&gt;SAS Enterprise Guide: 7.15&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have tried below, but receiving this ERROR: CLI error trying to establish connection: [Microsoft][ODBC Driver Manager] Invalid string or buffer length&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;%let server = XYZ;&lt;BR /&gt;%let database = ABC;&lt;/P&gt;
&lt;P&gt;proc sql;&lt;/P&gt;
&lt;P&gt;connect to odbc as myconn &lt;BR /&gt;(dsn="DRIVER={SQL Server Native Client 11.0};SERVER=&amp;amp;server;DATABASE=&amp;amp;database;Trusted_Connection=yes");&lt;BR /&gt;&lt;BR /&gt;create table work.mytable as&lt;BR /&gt;select *&lt;/P&gt;
&lt;P&gt;from connection to myconn (&lt;/P&gt;
&lt;P&gt;select *&lt;/P&gt;
&lt;P&gt;from dbo.test);&lt;/P&gt;
&lt;P&gt;disconnect from myconn;&lt;BR /&gt;quit;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Please let me know if needed more details.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks,&lt;/P&gt;
&lt;P&gt;Paulina&lt;/P&gt;</description>
      <pubDate>Wed, 16 Aug 2023 17:41:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Connection-String-For-SAS-EG-to-SQL-Server-using-Windows-Auth/m-p/889532#M43475</guid>
      <dc:creator>paulinalawson</dc:creator>
      <dc:date>2023-08-16T17:41:47Z</dc:date>
    </item>
    <item>
      <title>Re: Connection String For SAS EG to SQL Server using Windows Auth</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Connection-String-For-SAS-EG-to-SQL-Server-using-Windows-Auth/m-p/889539#M43476</link>
      <description>&lt;P&gt;Typically when you use EG, your SAS code is running on a remote SAS server, not your local Windows PC.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;That means the ODBC connection needs to be defined on the SAS server, and use ODBC drivers that are on server. Typically this would be configured by a SAS server administrator, not an individual programmer.&amp;nbsp; So as a first step, you might want to ask your admin or other colleagues how they connect to SQL server databases from the SAS server.&lt;/P&gt;</description>
      <pubDate>Wed, 16 Aug 2023 18:30:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Connection-String-For-SAS-EG-to-SQL-Server-using-Windows-Auth/m-p/889539#M43476</guid>
      <dc:creator>Quentin</dc:creator>
      <dc:date>2023-08-16T18:30:43Z</dc:date>
    </item>
    <item>
      <title>Re: Connection String For SAS EG to SQL Server using Windows Auth</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Connection-String-For-SAS-EG-to-SQL-Server-using-Windows-Auth/m-p/889541#M43477</link>
      <description>Thank you for your response!&lt;BR /&gt;I'm also the admin for the SAS Server, I did make sure that the ODBC connection is defined on the server and the ODBC driver that's on the server is "SQL Server Native Client 11.0"&lt;BR /&gt;&lt;BR /&gt;All of our users are able to connect to the SQL server using username and password on their local machines from SAS EG, no issues on that. We want to establish same connection using  Windows Auth rather than providing sql credentials.</description>
      <pubDate>Wed, 16 Aug 2023 18:55:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Connection-String-For-SAS-EG-to-SQL-Server-using-Windows-Auth/m-p/889541#M43477</guid>
      <dc:creator>paulinalawson</dc:creator>
      <dc:date>2023-08-16T18:55:04Z</dc:date>
    </item>
    <item>
      <title>Re: Connection String For SAS EG to SQL Server using Windows Auth</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Connection-String-For-SAS-EG-to-SQL-Server-using-Windows-Auth/m-p/889543#M43478</link>
      <description>&lt;P&gt;So your SAS server is a Windows server? And they authenticate to the SAS server using their Windows authentication?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;(I'm not an admin, and I've only worked on linux servers, so won't be able to help much.)&lt;/P&gt;</description>
      <pubDate>Wed, 16 Aug 2023 18:58:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Connection-String-For-SAS-EG-to-SQL-Server-using-Windows-Auth/m-p/889543#M43478</guid>
      <dc:creator>Quentin</dc:creator>
      <dc:date>2023-08-16T18:58:13Z</dc:date>
    </item>
    <item>
      <title>Re: Connection String For SAS EG to SQL Server using Windows Auth</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Connection-String-For-SAS-EG-to-SQL-Server-using-Windows-Auth/m-p/889545#M43479</link>
      <description>Yes, SAS Server is installed on Windows Server. The users authenticate to the SAS server from their local (using EG) using windows auth.</description>
      <pubDate>Wed, 16 Aug 2023 19:11:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Connection-String-For-SAS-EG-to-SQL-Server-using-Windows-Auth/m-p/889545#M43479</guid>
      <dc:creator>paulinalawson</dc:creator>
      <dc:date>2023-08-16T19:11:42Z</dc:date>
    </item>
    <item>
      <title>Re: Connection String For SAS EG to SQL Server using Windows Auth</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Connection-String-For-SAS-EG-to-SQL-Server-using-Windows-Auth/m-p/889546#M43480</link>
      <description>&lt;P&gt;Here is what I have used directly:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;libname ref '\\ABC.corp\dfsroot\BSC\SAS';&lt;BR /&gt;libname SQLREF ODBC NOPROMPT="server=SVDSQLASASREFERENCED;driver=ODBC Driver 13 for SQL Server;database=DB;trusted_connection=yes" STRINGDATES=NO IGNORE_READ_ONLY_COLUMNS=YES SCHEMA=DBO;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data SQLREF.Factor;&lt;BR /&gt;set ref.Factor ;&lt;BR /&gt;run;&lt;/P&gt;</description>
      <pubDate>Wed, 16 Aug 2023 19:12:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Connection-String-For-SAS-EG-to-SQL-Server-using-Windows-Auth/m-p/889546#M43480</guid>
      <dc:creator>AlanC</dc:creator>
      <dc:date>2023-08-16T19:12:32Z</dc:date>
    </item>
    <item>
      <title>Re: Connection String For SAS EG to SQL Server using Windows Auth</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Connection-String-For-SAS-EG-to-SQL-Server-using-Windows-Auth/m-p/889547#M43481</link>
      <description>Also, if you are server admin, I would get it working on the server using DMS and then try and get it working via EG.</description>
      <pubDate>Wed, 16 Aug 2023 19:16:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Connection-String-For-SAS-EG-to-SQL-Server-using-Windows-Auth/m-p/889547#M43481</guid>
      <dc:creator>AlanC</dc:creator>
      <dc:date>2023-08-16T19:16:22Z</dc:date>
    </item>
    <item>
      <title>Re: Connection String For SAS EG to SQL Server using Windows Auth</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Connection-String-For-SAS-EG-to-SQL-Server-using-Windows-Auth/m-p/889550#M43482</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/189014"&gt;@paulinalawson&lt;/a&gt;&amp;nbsp;- Try hard coded syntax first. This is how we do:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;libname SQLSRVR odbc noprompt = "server=SQLServerName;DRIVER=SQL Server Native Client 11.0;Trusted_Connection=yes" DATABASE = MyDatabase schema = dbo;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Connection strings are very sensitive to syntax so can be very fiddly to get right.&lt;/P&gt;</description>
      <pubDate>Wed, 16 Aug 2023 20:04:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Connection-String-For-SAS-EG-to-SQL-Server-using-Windows-Auth/m-p/889550#M43482</guid>
      <dc:creator>SASKiwi</dc:creator>
      <dc:date>2023-08-16T20:04:19Z</dc:date>
    </item>
    <item>
      <title>Re: Connection String For SAS EG to SQL Server using Windows Auth</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Connection-String-For-SAS-EG-to-SQL-Server-using-Windows-Auth/m-p/889565#M43483</link>
      <description>Thank you very much, Alan! That's helpful.</description>
      <pubDate>Wed, 16 Aug 2023 22:05:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Connection-String-For-SAS-EG-to-SQL-Server-using-Windows-Auth/m-p/889565#M43483</guid>
      <dc:creator>paulinalawson</dc:creator>
      <dc:date>2023-08-16T22:05:50Z</dc:date>
    </item>
    <item>
      <title>Re: Connection String For SAS EG to SQL Server using Windows Auth</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Connection-String-For-SAS-EG-to-SQL-Server-using-Windows-Auth/m-p/889566#M43484</link>
      <description>Thank you very much! creating the library first and then query from the library works.</description>
      <pubDate>Wed, 16 Aug 2023 22:07:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Connection-String-For-SAS-EG-to-SQL-Server-using-Windows-Auth/m-p/889566#M43484</guid>
      <dc:creator>paulinalawson</dc:creator>
      <dc:date>2023-08-16T22:07:00Z</dc:date>
    </item>
    <item>
      <title>Re: Connection String For SAS EG to SQL Server using Windows Auth</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Connection-String-For-SAS-EG-to-SQL-Server-using-Windows-Auth/m-p/889573#M43485</link>
      <description>&lt;P&gt;You can also use a LIBNAME definition in a PROC SQL CONNECT statement:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;libname sqlsrvr noprompt='&amp;lt;sql connection string&amp;gt;';

proc sql;
  connect using sqlsrvr;
  select * from ......;
quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 17 Aug 2023 02:12:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Connection-String-For-SAS-EG-to-SQL-Server-using-Windows-Auth/m-p/889573#M43485</guid>
      <dc:creator>SASKiwi</dc:creator>
      <dc:date>2023-08-17T02:12:39Z</dc:date>
    </item>
  </channel>
</rss>

