DISCLAIMER: I have little SQL Server knowledge and there's a 50% chance I
will post bad advice.
You can execute osql in a batch.
osql -S SERVERNAME -U SQLLogon -P ThePassword -i PathToFileWithSQLQuery
You can build your SQL in the batch if you like by doing something like:
ECHO SELECT [Something] FROM [Somewhere] WHERE
You can pipe your query to a file by doing something like:
osql -S SERVERNAME -U SQLLogon -P ThePassword -i
Use >> if you'd like to append to a file instead of overwriting if you
output to a file.
Ray at work
"ugotthe8" <com> wrote in message