C:\>osql /?
用法: 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]
  [-O use Old ISQL behavior disables the following]
      <EOF> 正在进行批处理
      控制台宽度自动调整
      宽消息
      默认错误级别为 — 1 对 1
  [-? show syntax summary]

Windows集成身份登陆>>>
C:\>osql -E
1>
登陆后执行系统存储过程
1> sp_password NULL,"newpass","sa"
2> go
密码已更改。
1> exit

再来看看sa混合模式登陆>>>
C:\>osql -SLocalhost -Usa -Pnewpass
1>
出现1>提示符表示登陆成功!

再来看看osql命令行下查询C:\>osql -SLocalhost -Usa -Pnewpass
1> use qz
2> Select count(*) from crjsj where kh=0
3> go

 -----------
           0

(1 行受到影响)
1>
查询系统表
1> select name from sysobjects where xtype='U'
2> go
 name