<?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>Question Re: How do I access an OS environment variable from SQL? in Technology Q&amp;A</title>
    <link>https://community.sap.com/t5/technology-q-a/how-do-i-access-an-os-environment-variable-from-sql/qaa-p/13835314#M4866157</link>
    <description>&lt;BLOCKQUOTE&gt;
&lt;P&gt;other, better, smarter, easier &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;</description>
    <pubDate>Fri, 17 Aug 2012 11:52:54 GMT</pubDate>
    <dc:creator>VolkerBarth</dc:creator>
    <dc:date>2012-08-17T11:52:54Z</dc:date>
    <item>
      <title>How do I access an OS environment variable from SQL?</title>
      <link>https://community.sap.com/t5/technology-q-a/how-do-i-access-an-os-environment-variable-from-sql/qaq-p/13835310</link>
      <description>&lt;P&gt;Say, I want to access the value of the Windows %TEMP% setting in order to write output to a particular directory...&lt;/P&gt;
&lt;P&gt;Just as "cross documentation" - as it has been dealt with as a side effect of this &lt;A href="http://sqlanywhere-forum.sap.com/questions/13089" target="_blank"&gt;question dealing witb DBISQL&lt;/A&gt;.&lt;/P&gt;</description>
      <pubDate>Fri, 17 Aug 2012 04:50:10 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/how-do-i-access-an-os-environment-variable-from-sql/qaq-p/13835310</guid>
      <dc:creator>VolkerBarth</dc:creator>
      <dc:date>2012-08-17T04:50:10Z</dc:date>
    </item>
    <item>
      <title>Re: How do I access an OS environment variable from SQL?</title>
      <link>https://community.sap.com/t5/technology-q-a/how-do-i-access-an-os-environment-variable-from-sql/qaa-p/13835311#M4866154</link>
      <description>&lt;P&gt;AFAIK, there doesn't seem to be a builtin function, but here are some suggestions for Windows:&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;&lt;A href="http://sqlanywhere-forum.sap.com/questions/13089#13090"&gt;Using xp_cmdshell and xp_read_file&lt;/A&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;A href="http://sqlanywhere-forum.sap.com/questions/13089#13090"&gt;Using an external function that wraps the GetEnvironmentVariable() Windows API&lt;/A&gt;&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;If you know other, better, smarter, easier solutions - please add them...&lt;/P&gt;</description>
      <pubDate>Fri, 17 Aug 2012 04:52:56 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/how-do-i-access-an-os-environment-variable-from-sql/qaa-p/13835311#M4866154</guid>
      <dc:creator>VolkerBarth</dc:creator>
      <dc:date>2012-08-17T04:52:56Z</dc:date>
    </item>
    <item>
      <title>Re: How do I access an OS environment variable from SQL?</title>
      <link>https://community.sap.com/t5/technology-q-a/how-do-i-access-an-os-environment-variable-from-sql/qaa-p/13835312#M4866155</link>
      <description>&lt;P&gt;If you have the Perl external environment setup, this function will return value of the environment variable passed in:&lt;/P&gt;
&lt;DIV class="codehilite"&gt;&lt;PRE&gt;&lt;SPAN class="n"&gt;CREATE&lt;/SPAN&gt; &lt;SPAN class="n"&gt;FUNCTION&lt;/SPAN&gt; &lt;SPAN class="n"&gt;getenv&lt;/SPAN&gt;&lt;SPAN class="p"&gt;(&lt;/SPAN&gt; &lt;SPAN class="n"&gt;env&lt;/SPAN&gt; &lt;SPAN class="n"&gt;LONG&lt;/SPAN&gt; &lt;SPAN class="n"&gt;VARCHAR&lt;/SPAN&gt; &lt;SPAN class="p"&gt;)&lt;/SPAN&gt;
&lt;SPAN class="n"&gt;RETURNS&lt;/SPAN&gt; &lt;SPAN class="n"&gt;LONG&lt;/SPAN&gt; &lt;SPAN class="n"&gt;VARCHAR&lt;/SPAN&gt;
&lt;SPAN class="n"&gt;EXTERNAL&lt;/SPAN&gt; &lt;SPAN class="n"&gt;NAME&lt;/SPAN&gt; &lt;SPAN class="s"&gt;'$sa_perl_return = $ENV{$sa_perl_arg0}'&lt;/SPAN&gt;
&lt;SPAN class="n"&gt;LANGUAGE&lt;/SPAN&gt; &lt;SPAN class="n"&gt;PERL&lt;/SPAN&gt;
&lt;/PRE&gt;&lt;/DIV&gt;


&lt;P&gt;You can do something similar with any of the other external environments, but Perl is most convenient because you can embed the code right in the external name, without having to deal with distributing dlls or jars.&lt;/P&gt;</description>
      <pubDate>Fri, 17 Aug 2012 11:38:35 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/how-do-i-access-an-os-environment-variable-from-sql/qaa-p/13835312#M4866155</guid>
      <dc:creator>former_SQLA_member1694884</dc:creator>
      <dc:date>2012-08-17T11:38:35Z</dc:date>
    </item>
    <item>
      <title>Re: How do I access an OS environment variable from SQL?</title>
      <link>https://community.sap.com/t5/technology-q-a/how-do-i-access-an-os-environment-variable-from-sql/qaa-p/13835314#M4866157</link>
      <description>&lt;BLOCKQUOTE&gt;
&lt;P&gt;other, better, smarter, easier &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;</description>
      <pubDate>Fri, 17 Aug 2012 11:52:54 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/how-do-i-access-an-os-environment-variable-from-sql/qaa-p/13835314#M4866157</guid>
      <dc:creator>VolkerBarth</dc:creator>
      <dc:date>2012-08-17T11:52:54Z</dc:date>
    </item>
    <item>
      <title>Re: How do I access an OS environment variable from SQL?</title>
      <link>https://community.sap.com/t5/technology-q-a/how-do-i-access-an-os-environment-variable-from-sql/qaa-p/13835313#M4866156</link>
      <description>&lt;P&gt;I have now formally added this as a product enhancement request as CR #717193 (e.g. something like &lt;CODE&gt;xp_putenv()&lt;/CODE&gt; and  &lt;CODE&gt;xp_getenv()&lt;/CODE&gt;) to be potentially targeted for a future version of SQL Anywhere.&lt;/P&gt;
&lt;P&gt;Thank you for the enhancement suggestion.&lt;/P&gt;</description>
      <pubDate>Fri, 17 Aug 2012 12:18:31 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/how-do-i-access-an-os-environment-variable-from-sql/qaa-p/13835313#M4866156</guid>
      <dc:creator>jeff_albion</dc:creator>
      <dc:date>2012-08-17T12:18:31Z</dc:date>
    </item>
    <item>
      <title>Re: How do I access an OS environment variable from SQL?</title>
      <link>https://community.sap.com/t5/technology-q-a/how-do-i-access-an-os-environment-variable-from-sql/qaa-p/13835315#M4866158</link>
      <description>&lt;P&gt;Thanks for considering a "quest for solutions" as an "enhancement suggestion" - you sure listen to your customers:)&lt;/P&gt;</description>
      <pubDate>Fri, 17 Aug 2012 12:38:31 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/how-do-i-access-an-os-environment-variable-from-sql/qaa-p/13835315#M4866158</guid>
      <dc:creator>VolkerBarth</dc:creator>
      <dc:date>2012-08-17T12:38:31Z</dc:date>
    </item>
    <item>
      <title>Re: How do I access an OS environment variable from SQL?</title>
      <link>https://community.sap.com/t5/technology-q-a/how-do-i-access-an-os-environment-variable-from-sql/qaa-p/13835316#M4866159</link>
      <description>&lt;P&gt;&lt;A href="https://sqlanywhere-forum.sap.com/users/108/jeff-albion/"&gt;@Jeff&lt;/A&gt;: There are a sackload of simple Windows API entry points that deserve the xp_treatment, or something like it. If only it wasn't so screamingly difficult to use the SQL-Anywhere-to-C interface... no, don't go on about the LANGUAGE WHATEVER interfaces, it's nice that the WHATEVER fans have their RFP checkpoints, but while C might be loathsome it's still the best way to get down and dirty with the OS &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 17 Aug 2012 13:56:43 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/how-do-i-access-an-os-environment-variable-from-sql/qaa-p/13835316#M4866159</guid>
      <dc:creator>Breck_Carter</dc:creator>
      <dc:date>2012-08-17T13:56:43Z</dc:date>
    </item>
    <item>
      <title>Re: How do I access an OS environment variable from SQL?</title>
      <link>https://community.sap.com/t5/technology-q-a/how-do-i-access-an-os-environment-variable-from-sql/qaa-p/13835317#M4866160</link>
      <description>&lt;P&gt;Hi Breck,&lt;/P&gt;
&lt;P&gt;Are there any Windows API entry points that have equivalents across other POSIX OSes that you would be interested in us implementing?&lt;/P&gt;
&lt;P&gt;There are indeed a lot of "Windows specific" functions (I have encountered Registry editing/searching requests from customers before) that could &lt;EM&gt;potentially&lt;/EM&gt; go into xp_* functions, but the xp_* functions are really intended to be available cross-platform: &lt;A href="http://www.sybase.com/detail?id=1091125#SA"&gt;&lt;/A&gt;&lt;A href="http://www.sybase.com/detail?id=1091125#SA"&gt;&lt;/A&gt;&lt;A href="http://www.sybase.com/detail?id=1091125#SA"&gt;http://www.sybase.com/detail?id=1091125#SA&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;Which 'sackload' of API points were you specifically thinking of? &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 17 Aug 2012 17:16:13 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/how-do-i-access-an-os-environment-variable-from-sql/qaa-p/13835317#M4866160</guid>
      <dc:creator>jeff_albion</dc:creator>
      <dc:date>2012-08-17T17:16:13Z</dc:date>
    </item>
  </channel>
</rss>

