osql is a command-line program to interact with Sql Server, and is useful for launching scheduled batch files of Sql commands.
Well, it is deprecated, and sqlcmd is the new program to do the same thing.
I've come across one oddity: it is common to include print statements so that the output log file is more 'human readable', and easier to grep through, etc.
In weird combinations, calling:
print 'print text'
in a batch file will log out:
“0 rows affected.”
This should never happen with a print statement, and you should be able to supress it with:
'set nocount on'
However, that command will only produce the desired behavior when followed with an explicit 'go' command. 'Set nocount off' takes effect immediately without an explicit 'go.'