cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

How do I access an OS environment variable from SQL?

VolkerBarth
Contributor
11,308

Say, I want to access the value of the Windows %TEMP% setting in order to write output to a particular directory...

Just as "cross documentation" - as it has been dealt with as a side effect of this question dealing witb DBISQL.

View Entire Topic
jeff_albion
Product and Topic Expert
Product and Topic Expert

I have now formally added this as a product enhancement request as CR #717193 (e.g. something like xp_putenv() and xp_getenv()) to be potentially targeted for a future version of SQL Anywhere.

Thank you for the enhancement suggestion.

VolkerBarth
Contributor

Thanks for considering a "quest for solutions" as an "enhancement suggestion" - you sure listen to your customers:)

Breck_Carter
Participant

@Jeff: 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 🙂

jeff_albion
Product and Topic Expert
Product and Topic Expert
0 Likes

Hi Breck,

Are there any Windows API entry points that have equivalents across other POSIX OSes that you would be interested in us implementing?

There are indeed a lot of "Windows specific" functions (I have encountered Registry editing/searching requests from customers before) that could potentially go into xp_* functions, but the xp_* functions are really intended to be available cross-platform: http://www.sybase.com/detail?id=1091125#SA

Which 'sackload' of API points were you specifically thinking of? 🙂