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]" Query all libraries
------
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
Remember
C:\windows\syswow64\> taskkill-f/im OSQL. Exe
Success: The process "OSQL" has been terminated. EXE "with a PID of 2992.
Success: The process "OSQL" has been terminated. EXE "with a PID of 6196.
Success: The process "OSQL" has been terminated. EXE "with a PID of 4368.
Success: The process "OSQL" has been terminated. EXE "with a PID of 3700.
Success: The process "OSQL" has been terminated. EXE "with a PID of 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 query Zzfwdata which tables
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
Query This table for this zzfwdata. All the contents of 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\quan Bu.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
OSQL. EXE command line off the pants MSSQL