isqlw Utility

The isqlw utility (SQL Server Query Analyzer) allows you to enter Transact-SQL statements, system stored procedures, and script files.  You can set up shortcuts or create batch files to launch a preconfigured SQL Server Query Analyzer.

Syntax

isqlw [[-?][-S server][-d database][-E][-U user] [-P password]
    {[-i input_file][-o output_file]}[-F U | A | O]
    [-scolumn_separator”][-f file_list]]

Arguments
[-?]
Displays usage information.
[-S server]
Specifies the Microsoft® SQL Server™ installation to which to connect. server is the network name of the server. This option is required if you are executing isqlw from a remote computer on the network. The default is local.
[-d database]
Issues a USE database statement when isqlw is started. The default is the default database of the user.
[-E]
Uses a trusted connection instead of requesting a password.
[-U user]
Is the user login ID. Login IDs are case-sensitive.
[-P password]
Is the login password. The default is NULL.
[-i input_file]
Identifies the file that contains a batch of SQL statements or stored procedures. If -i is specified, the output file name must also be specified with -o. When -i and -o options are specified, queries in the input file are executed and results are saved in the output file. No user interface is shown while the queries are executing. When execution is completed, the process exits.
[-o output_file]
Identifies the file that receives output from isqlw. If file format is not specified with -F, the output file will be of the same type as the input file.
[-F U | A | O]
Is the file format. Values include Unicode, ANSI, and OEM. If -F is not specified, automatic mode is used (if the file is Unicode signed, the file is opened as Unicode; otherwise, the file is opened as ANSI).
[-scolumn_separator”]
Specifies the column-separator character, which is a blank space by default. To use characters that have special meaning to the operating system (for example, | ; & < >), enclose the character in double quotation marks (“).
[-f file_list]
Loads the files listed into SQL Server Query Analyzer. With the -f option, you can load one or more files (file names separated by single space). If more than one file is specified, files are opened on the same connection context. The file name can include the directory path where the file resides. Wildcard characters (such as C:\Test\*.sql) can be used.
Remarks

The isqlw utility is started directly from the operating system with the case-sensitive options listed here. After starting, SQL Server Query Analyzer accepts SQL statements and sends them to SQL Server interactively. The results are formatted and displayed on the screen. Use the File/Exit menu option or Alt+F4 to exit from isqlw.

If no arguments are specified, isqlw starts SQL Server Query Analyzer and interactively takes the input (server, login, and password). If no valid connection properties are specified (for example, if no trusted connection is specified and the login name is also missing), the normal connection dialog box for SQL Server Query Analyzer appears.

SQL Server Query Analyzer uses the ODBC API. The utility uses the Microsoft SQL Server ODBC driver default settings for SQL-92, except for QUOTED_IDENTIFIER. SQL Server Query Analyzer defaults to setting QUOTED_IDENTIFIER OFF. To set the option on, go to the Query\Current Connection Options menu and select Use ANSI quoted identifiers in the General tab. For more information, see Effects of SQL-92 Options.

To use isqlw interactively, enter the isqlw command (and any of the options) at a command prompt.

Examples

A. Executing SQL statements

This example connects to MyServer (pubs database) and executes SQL statements from input_file and stores the results of the execution in output_file.

isqlw -S MyServer -d pubs -U sa -P -i input_file -o output_file

B. Using wildcards

This example loads all .sql files into SQL Server Query Analyzer.  All connections use Windows NT Authentication and point to the pubs database on the local server.

isqlw -d pubs -E -f c:\mssql7\install\*.sql

C. Loading multiple files

This example loads two files into SQL Server Query Analyzer.  It uses Windows NT Authentication to connect to the local server.

isqlw -d pubs -E -f c:\mssql7\install\instpubs.sql c:\mssql7\install\instcat.sql

D. Using Unicode files

This example connects to the pubs database on MyServer using Windows NT Authentication and executes the Input.sql file. The results are saved in the Output.txt file.  The files are opened as Unicode files.

isqlw -S MyServer -d pubs -E -i input.sql -o output.txt -FU


(c) 1988-98 Microsoft Corporation. All Rights Reserved.