cmdsql takes upto 7 command line parameters.
| 1 |
Server |
The name or IP of the MS SQL server.
If set to "?", cmdsql ignores other parameters, scans available SQL servers by UDP broadcasting, then exits. |
2 |
user |
The login name of the user's account. If set to blank, Windows NT Authentication (trusted connection) is used. |
| 3 |
password |
The login password of the user's account.Ignored if user is blank. |
| 4 |
database |
The name of the database to open. |
| 5 |
sql |
the SQL commands or SQL script file path to be executed. |
| 6 |
Output |
- blank: Output to console window.
- print: Output to default printer.
- copy: Output to text clipboard.
- Text File Path: Output to text file.
- HTML File Path: Output to HTML file.
- Excel File Path: Output to Excel Sheets.
|
| 6 |
Output Control |
- -r: Suppress query results (recordsets)
- -m: Suppress message
- +open: Open output file
|
| Command Line |
Action |
| cmdsql (local) |
Login to the local SQL server using Windows NT Authentication.
cmdsql enters Interactive Mode.
|
| cmdsql mysvr "" "" msh |
Login to SQL Server "mysvr" using Windows NT Authentication and open "msh" as current database.
cmdsql enters Interactive Mode.
|
| cmdsql mysvr john john-pass |
Login to SQL Server "mysvr" using SQL Server Account.
cmdsql enters Interactive Mode.
|
| cmdsql mysvr john john-pass msh |
Login to SQL Server "mysvr" using SQL Server Account and open "msh" as current database.
cmdsql enters Interactive Mode.
|
| cmdsql mysvr "" "" msh "select * from [Employees]" |
Login to SQL Server "mysvr" using Windows NT Authentication,
open "msh" as current database,
execute the sql, send output to console window, then exit.
|
| cmdsql mysvr "" "" msh "script.sql" "query.htm" "-m+open" |
Login to SQL Server "mysvr" using Windows NT Authentication,
open "msh" as current database,
execute the sql script file, save output to a HTML file, open the HTML file, then exit.
|
If less then 5 command line parameters are presend, CMDSQL enters interactive mode.
In interactive mode, your SQL command is buffered - you don't have to finish a long SQL command in one line.
The buffered SQL command will not be executed until you enter a CMDSQL command.
A CMDSQL command determines how the buffered SQL command is to be executed.
It can be: