<?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: running sql server 2005 stored procedure from proc sql via sql pass-thru in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/running-sql-server-2005-stored-procedure-from-proc-sql-via-sql/m-p/43569#M11417</link>
    <description>I was able to get a result set back by calling this SQL stored procedure with two input parameters (in example below the parameters are 0, null) with this syntax:&lt;BR /&gt;
&lt;BR /&gt;
proc sql;&lt;BR /&gt;
  connect to odbc as DW (dsn="blah" uid=xxxx pwd=xxxx);&lt;BR /&gt;
  create table TMP as&lt;BR /&gt;
    select *&lt;BR /&gt;
    from connection to DW (&lt;BR /&gt;
      EXEC dbo.spName 0,null&lt;BR /&gt;
  );&lt;BR /&gt;
quit;</description>
    <pubDate>Thu, 11 Sep 2008 19:56:24 GMT</pubDate>
    <dc:creator>deleted_user</dc:creator>
    <dc:date>2008-09-11T19:56:24Z</dc:date>
    <item>
      <title>running sql server 2005 stored procedure from proc sql via sql pass-thru</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/running-sql-server-2005-stored-procedure-from-proc-sql-via-sql/m-p/43567#M11415</link>
      <description>Hi,&lt;BR /&gt;
I want to run a sql server stored procedure called "getdata" that has two parameters which returns a certain result-set, which if I were to call from within sql server query analyzer would look like this: &lt;BR /&gt;
&lt;BR /&gt;
EXEC dbo.getdata 1,null&lt;BR /&gt;
&lt;BR /&gt;
This runs the getdata stored procedure by passing in a "1" as the value of the first parameter, and a "null" as the value of the second parameter.&lt;BR /&gt;
&lt;BR /&gt;
How do I call this from SAS?  Here's how I normally use SQL pass-thru to get to the database in question:&lt;BR /&gt;
&lt;BR /&gt;
proc sql;&lt;BR /&gt;
     connect to odbc as DW (dsn="blah" uid=xxxx pwd=xxxx);&lt;BR /&gt;
     create table SAMPLE as&lt;BR /&gt;
     select * from connection to DW (&lt;BR /&gt;
         BLAH BLAH BLAH&lt;BR /&gt;
     );&lt;BR /&gt;
quit;&lt;BR /&gt;
&lt;BR /&gt;
thanks!</description>
      <pubDate>Tue, 02 Sep 2008 19:36:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/running-sql-server-2005-stored-procedure-from-proc-sql-via-sql/m-p/43567#M11415</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2008-09-02T19:36:34Z</dc:date>
    </item>
    <item>
      <title>Re: running sql server 2005 stored procedure from proc sql via sql pass-thru</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/running-sql-server-2005-stored-procedure-from-proc-sql-via-sql/m-p/43568#M11416</link>
      <description>Hi.&lt;BR /&gt;
your option would might be using a EXECUTE statement in proc sql. It allows you to call stored procedures within your DBMS. But it has the following limitation (from on-line doc):&lt;BR /&gt;
&lt;BR /&gt;
"However, stored procedures with output parameters are not supported in the Pass-Through Facility."&lt;BR /&gt;
&lt;BR /&gt;
If your result set is other than just a return code (obtained by &amp;amp;SQLXRC and &amp;amp;SQLXMSG), I think you have to find another way to pass the result to SAS (using some other interface or store the result as an external file).&lt;BR /&gt;
&lt;BR /&gt;
Regards,&lt;BR /&gt;
Linus</description>
      <pubDate>Thu, 04 Sep 2008 07:47:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/running-sql-server-2005-stored-procedure-from-proc-sql-via-sql/m-p/43568#M11416</guid>
      <dc:creator>LinusH</dc:creator>
      <dc:date>2008-09-04T07:47:07Z</dc:date>
    </item>
    <item>
      <title>Re: running sql server 2005 stored procedure from proc sql via sql pass-thru</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/running-sql-server-2005-stored-procedure-from-proc-sql-via-sql/m-p/43569#M11417</link>
      <description>I was able to get a result set back by calling this SQL stored procedure with two input parameters (in example below the parameters are 0, null) with this syntax:&lt;BR /&gt;
&lt;BR /&gt;
proc sql;&lt;BR /&gt;
  connect to odbc as DW (dsn="blah" uid=xxxx pwd=xxxx);&lt;BR /&gt;
  create table TMP as&lt;BR /&gt;
    select *&lt;BR /&gt;
    from connection to DW (&lt;BR /&gt;
      EXEC dbo.spName 0,null&lt;BR /&gt;
  );&lt;BR /&gt;
quit;</description>
      <pubDate>Thu, 11 Sep 2008 19:56:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/running-sql-server-2005-stored-procedure-from-proc-sql-via-sql/m-p/43569#M11417</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2008-09-11T19:56:24Z</dc:date>
    </item>
  </channel>
</rss>

