Drop Table

Support Forum for database administrators and web based access to important newsgroups related to databases
Register on Database Support Forum Edit your profileCalendarFind other Database Support forum membersFrequently Asked QuestionsSearch this forum -> 
For Database admins: Free Database-related Magazines Now Free shipping to Texas


Post New Thread










Thread
Author

Return string value from OSQL statement
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.


Report this thread to moderator Post Follow-up to this message
Old Post
joemorrissey@gmail.com
07-28-05 12:23 PM


Sponsored Links





Last Thread Next Thread
Post New Thread

MS SQL Server archive

Show a Printable Version Email This Page to Someone! Receive updates to this thread
Microsoft SQL Server
Access database support
PostgreSQL Replication
SQL Server ODBC
FoxPro Support
PostgreSQL pgAdmin
SQL Server Clustering
MySQL ODBC
Web Applications with dBASE
SQL Server CE
MySQL++
Sybase Database Support
MS SQL Full Text Search
PostgreSQL Administration
SQL Anywhere support
DB2 UDB Database
Paradox Database Support
Filemaker Database
Berkley DB
SQL 2000/2000i database
ASE Database
Forum Jump:
All times are GMT. The time now is 11:20 AM.

 
Mobile devices forum | Database support forum archive




Copyrights DropTable.com Database Support Forum 2004 - 2006