cd C:\Program Files\Microsoft SQL Server\100\Tools\Binn\
OSQL.EXE -S "localhost" -U "sa" -P "123456789" -q "select [name] from [sysdatabases] order by [name]" 查询所有库
------
fwweb
master
model
msdb
oadata
ReportServer
ReportServerT
tempdb
zzfwdata
oadata
"C:\Program Files\Microsoft SQL Server\100\Tools\Binn\OSQL.EXE" -S "localhost" -U "sa" -P "123456789" -q "Select TABLE_NAME FROM
oadata.INFORMATION_SCHEMA.TABLES Where TABLE_TYPE=‘BASE TABLE‘"
zzfwdata
"C:\Program Files\Microsoft SQL Server\100\Tools\Binn\OSQL.EXE" -S "localhost" -U "sa" -P "123456789" -q "Select TABLE_NAME FROM
zzfwdata.INFORMATION_SCHEMA.TABLES Where TABLE_TYPE=‘BASE TABLE‘" > D:\newweb\fwweb\ad\zzfwdata.txt
记得
C:\Windows\SysWOW64\> taskkill -F /im OSQL.EXE
成功: 已终止进程 "OSQL.EXE",其 PID 为 2992。
成功: 已终止进程 "OSQL.EXE",其 PID 为 6196。
成功: 已终止进程 "OSQL.EXE",其 PID 为 4368。
成功: 已终止进程 "OSQL.EXE",其 PID 为 3700。
成功: 已终止进程 "OSQL.EXE",其 PID 为 2440。
"C:\Program Files\Microsoft SQL Server\100\Tools\Binn\OSQL.EXE" -S "localhost" -U "sa" -P "123456789" -q "select name from zzfwdata.dbo.sysobjects
where xtype=‘U‘" > D:\newweb\fwweb\ad\biao.txt 查询zzfwdata 有哪些表
fw_code
"C:\Program Files\Microsoft SQL Server\100\Tools\Binn\OSQL.EXE" -S "localhost" -U "sa" -P "123456789" -q "select * from zzfwdata.dbo.fw_code" > D:
\newweb\fwweb\ad\neirong2.txt
查询这个 zzfwdata.的这个表.fw_code 里面的所有内容
"C:\Program Files\Microsoft SQL Server\100\Tools\Binn\OSQL.EXE" -S "localhost" -U "sa" -P "123456789" -w 600 -q "select * from zzfwdata.dbo.fw_code" -o D:\newweb\fwweb\ad\quanbu.xls
"C:\Program Files\Microsoft SQL Server\100\Tools\Binn\OSQL.EXE" -S "localhost" -U "sa" -P "123456789" -w 600 -q SELECT * FROM zzfwdata.dbo.fw_code WHERE Address BETWEEN 10001 AND 20000 " -o D:\newweb\fwweb\ad\quanbu12.xls