| joemorrissey@gmail.com 2005-07-28, 7:23 am |
| Hi all,
I have written a batch file that runs the following osql to look up a
filename from a database (MyDatabase). To do this it runs a stored
procedure that I have created called GetLatestFileName. The sql in the
stored procedure is as follows:
select FILENAME
FROM IMPORTDATA
WHERE (DATA_ID = 'abc123')
GO
Here's the extract from my batch file:
:: Get latest data file
set mysqlcommand=GetLate
stFileName
set fileName=
osql -E -Slocalhost /d MyDatabase /Q %mysqlcommand% >> %OUTPUT_FILE%
echo Data file being used is %fileName% >> %OUTPUT_FILE%
In my log file (OUTPUT_FILE), I can see that the 'mysqlcommand' stored
procedure is returning the correct filename and writing it out. Do you
know how I could store this output directly in the local 'fileName'
variable that I have declared and which I need to use further on in the
batch file.
I can probably read the filename back in from the log file, but I can't
see the OSQL syntax that would allow me to put it straight into the
'fileName' variable.
Any help appreciated.
|