[A follow-up from Breck's comment on this question..., all tested with SA 12.0.0.2566.] In a CMD prompt, a simple call to DBTRAN a log file
works as expected - i.e. test.txt contains the output and test.err the (here expected) error that abc.log doesn't exist (in my case). The corresponding xp_cmdshell call shows that environment variables like SQLANY12 are recognized:
seems to replace the environment variable with the correct value. However, it does not seem to handle spaces in pathes correctly, as test.err txt contains the following error (translated from German):
Note, the %SQLANY12% value contains spaces, and so I put double quotes around the path specification. This works in the CMD box but not in xp_cmdshell, no matter if I use double quotes or doubled single quotes around the path. In contrast, the corresponding call with the expanded path works as expected:
Question: So how can environmnent variables with pathes including spaces be handled correctly? |
The other conclusion: Pathes including spaces are inherently evil...
That's why I always modify the default installation path to something like 'C:ProgrammeSybaseSQLAny11'. But with an english Windows version 'C:Program FilesSybaseSQLAny11' still contains a space ...