The -S
portion of the osql command tells osql where to find the SQL instance that you want to interact with. It typically consists of two parts -- the server name and the instance name.
You'll need to replace "myserver" with the name of the server that your SQL installation is running on. And, if your SQL installation is using a named instance, you'll need to replace "sqlexpress" with the name of that instance. If, on the other hand, you installed SQL as a default instance, you can leave out the part after the backslash.
Examples
I've got SQL running on a machine named DougSQL01. As a default instance. So my osql command would look like this:
osql -S DougSQL01 -E -i "c:\test.sql" -o "c:\output.txt"
I've got another instance of SQL running on another server, DougSQL02. This one is a named instance, with an instance name of "Testing". In this case, my osql command would look like this:
osql -S DougSQL02\Testing -E -i "c:\test.sql" -o "c:\output.txt"
There are some other subtleties about how to specify a server and an instance, like specifying a port instead of an instance name, using an IP address instead of a hostname, specifying "mssqlserver" for a default instance, and the ability to leave out the name of the instance if a named instance is running on port 1433, but none of them are likely to apply in your case.