osql utility allows you to enter T_SQL statements, system procedures, and text files, ODBC communicate with the server using osql The osql utility allows you to enter Transact-SQL statements, system procedures, and script files. This utility uses ODBC to communicate with the server.
Syntax: OSQL [-?] | [-L] | [{{-u login_id [-p password]} | E} [-S server_name [/ instance_name]] [-h wksta_name] [-d db_name] [-l Time_out] [-t time_out] [-h Headers] [-H HEADERS] [-W column_width] [-A packet_size] [-e] [-i] [-d data_source_name] [-c cmd_end] [-Q "Query "] [-Q" query "] [-n] [-m error_level] [-r {0 | 1}] [-i input_file] [-o output_file] [-P] [-b] [-u] [ -R] [-o]]
OSQL command
GO executes the statement input before GO
RESET empty all input statements
ED call editor
!! Command executes the operating system command
Quit or exit () exits OSQL.
Ctrl C ends a query but does not quit OSQL.
The number of integers behind the GO statement represents the number of executions. E.g
SELECT X = 1
GO 100
Indicates that the SELECT statement is executed 100 times
The OSQL does not accept more than 1000 characters per line, and the long sentence should be divided into a row.