Post a reply

Before posting, please read how to report bug or request support effectively.

Bug reports without an attached log file are usually useless.

Options
Add an Attachment

If you do not want to add an Attachment to your Post, please leave the Fields blank.

(maximum 10 MB; please compress large files; only common media, archive, text and programming file formats are allowed)

Options

Topic review

martin

naik.lakshman@gmail.com wrote:

Can u please tell me what is difference between system environment variable and user environment variable ?

System variable is shared between all users, while user variable is visible only by one user.
naik.lakshman@...

Can u please tell me what is difference between system environment variable and user environment variable ?

please mail at :
naik.lakshman@gmail.com
Guest

Thanks for your quick response. I checked that FAQ and the environment variable I am using is 'machine level' - not user dependent. But I did figure out what is going on. Apparently Microsoft SQL 'caches' the environment variables and values. I inserted a previously known variable %PATH% in the script and logged the results noting that the server 'path' was substituted in place of the variable. I then 'restarted' the SQL server agent - the service responsible for performing the task and it worked using my new environment variable - %FILE_TO_DOWNLOAD%'
So what I have concluded is this - environment variable usage should be noted as being potentially unreliable. It seems some server services do not refresh those values very often.
Is there any other way to pull a file where the name changes daily with the addition of the date in the format filename_yyyymmdd.zip? Can I substitute the date somehow else without rebuilding the script each day? The remote server does not remove the old copies of the file so using a wildcard would not be the best way to retrieve the file.
martin

Re: Use of Environment Variables in Scripting

Are you sure the ENV variable is set in the MSQL environment? Have you read this FAQ?
katmanrocks

Use of Environment Variables in Scripting

I am testing your use of environment variables in scripts using your BETA 4.1.4 version. When I launch the script from the inside the COMMAND.EXE window, it works fine - successfully replacing the environment variable with the actual file name stored in the system's environment. But when I launch the CMD EXEC from Microsoft SQL's job handler with the same command string, the environment variable (in the form %ENV%) does not get replaced with the stored fiel name. I have captured the logs in both occasions and that is the only difference. When I run it from SQL, it is acting like version 3 and attempts to retrieve a file named %ENV%.