SQL SERVER的命令列工具Osql的用法
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
-----------------------------------------------------------------------
sjd
sjdz
xgjsz
xtcs
pb
xtsz
qjcc
rszl
rz
t_Open_Event
t_Open_Event_history
xgsj
t_OpenDoorRecord_history
mjjcs2
t_OpenDoorRecord
mjjz2
mjkzqcs2
dtproperties
qjcc1
sjlxsm
kqsj2
bell
bm
card
department
crjsj
gly
gzsj_history
crjsj_history
jr
gzsj
kqjsz
gzsj_ssjksj
info
lever
kqbc
kqsj
kqsj_tp
lscrjsj
mjjcs
msgrz
parameter
picture
mjjz
qjlb
mjkzqcs
(46 行受到影響)
1>Exit
C:/>Osql 命令列的用途還很多,功能十分強大,常用就列舉這些了