OSQL. EXE command line off the pants MSSQL

Source: Internet
Author: User
Tags mssql

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.