Difference between isql.exe and osql.exe while executin

发表于:2007-06-07来源:作者:点击数: 标签:
isql does not support connecting to a named instance of SQL Server 2000 . If no server is specified, isql connects to the default instance of SQL Server on the local computer. This option is required if you are executing isql from a remote

isql does not support connecting to a named instance of SQL Server 2000. If no server is specified, isql connects to the default instance of SQL Server on the local computer. This option is required if you are executing isql from a remote computer.

All DB-Library applications, such as isql, work as SQL Server 6.5–level clients when connected to SQL Server 2000. They do not support some SQL Server 2000 features. The osql utility is based on ODBC and does support all SQL Server 2000 features. Use osql to run scripts that isql cannot run. For more information about the restrictions on SQL Server 6.5–level clients, see asp">Connecting Early Version Clients to SQL Server 2000 in SQL Server Books Online.

The SQL Query Analyzer default is to save SQL scripts as Unicode files. The isql utility does not support Unicode input files. Attempting to specify one of these files in the -i switch results in a 170 error:

Incorrect syntax near ' '.

Use the osql utility to run these Unicode files. An alternative is to specify ANSI instead of Unicode in the File format list of the SQL Query Analyzer File/Save As dialog box.

Like most DB-Library applications, the isql utility does not set any connection options by default. Users must issue SET statements interactively or in their scripts if they want to use specific connection option settings.

The isql utility is started directly from the operating system with the case-sensitive options listed here. After starting, isql accepts Transact-SQL statements and sends them to SQL Server 2000 interactively. The results are formatted and printed on the standard output device (the screen). Use QUIT or EXIT to exit from isql.

If you do not specify a user name when you start isql, SQL Server 2000 checks for the environment variables and uses those, for example, isqluser=(user) or isqlserver=(server). If no environment variables are set, the workstation user name is used. If you do not specify a server, the name of the workstation is used.

If neither the -U or -P options are used, SQL Server 2000 attempts to connect using Windows Authentication Mode. Authentication is based on the Windows NT account of the user running isql.

see details in asp?url=/library/en-us/coprompt/cp_isql_8r39.asp">http://msdn.microsoft.com/library/default.asp?url=/library/en-us/coprompt/cp_isql_8r39.asp

原文转自:http://www.ltesting.net