The basic connection command is as follows;
c:\>osql -U sa -S srv-sql\SQLSERVER2005
-S switch stands for server name (and instance, if applicable). The whole switches of osql are;
osql [-U login id] [-P password]
[-S server] [-H hostname]
[-E trusted connection]
[-d use database name] [-l login timeout] [-t query timeout]
[-h headers] [-s colseparator] [-w columnwidth]
[-a packetsize] [-e echo input]
[-I Enable Quoted Identifiers]
[-L list servers] [-c cmdend] [-D ODBC DSN name]
[-q "cmdline query"] [-Q "cmdline query" and exit]
[-n remove numbering] [-m errorlevel]
[-r msgs to stderr] [-V severitylevel]
[-i inputfile] [-o outputfile]
[-p print statistics] [-b On error batch abort]
[-X[1] disable commands [and exit with warning]]
[-O use Old ISQL behavior disables the following]
Auto console width scaling
Wide messages
default errorlevel is -1 vs 1