FIX: Executing Isqlw.exe with -i -o Parameters May Insert Text Into the Input SQL Script (289667)



The information in this article applies to:

  • Microsoft SQL Server 2000 (all editions)

This article was previously published under Q289667
BUG #: 351999 (SHILOH_BUGS)

SYMPTOMS

The isqlw utility (SQL Server Query Analyzer) allows you to enter Transact-SQL statements, system stored procedures, and script files. You can use the isqlw utility with or without a user interface. To run isqlw without a user interface, specify valid login information (an instance of SQL Server 2000 with a trusted connection or a valid login ID and password) and input and output files. Isqlw executes the contents of the input file and saves the results to the output file. After you execute the isqlw command with -i -o parameters, you may notice that the DOS command window loses focus. If you type some characters before SQL Server completes the execution, you might be able to overwrite the input SQL script and the following message boxes appear:
The text in C:\temp\test.sql has been changed.
Do you want to save the changes?


Yes/No/No to All/Cancel
If you click Yes, you see that the text you just typed was inserted into the first line of the C:\Temp\Test.sql file.

If you click No, the original SQL script is intact.

CAUSE

When you execute the isqlw command with -i -o parameters, the SQL Query Analyzer window is created, but is invisible. When you start typing, after the focus is lost, you are typing into the edit window of Query Analyzer. When the query execution completes and the edit window is ready to close, Query Analyzer prompts if you want to save the changes you just made.

RESOLUTION

To resolve this problem, obtain the latest service pack for SQL Server 2000. For additional information, click the following article number to view the article in the Microsoft Knowledge Base:

290211 INF: How to Obtain the Latest SQL Server 2000 Service Pack

WORKAROUND

To work around this problem, use Isql.exe or Osql.exe.

STATUS

Microsoft has confirmed that this is a problem in SQL Server 2000. This problem was first corrected in SQL Server 2000 Service Pack 1.

MORE INFORMATION

To illustrate this problem, use the following example:
  1. Create the following SQL script file in the C:\Temp folder:
    waitfor delay '0:0:10'
    go
    select @@version
    go
    					
  2. Execute the following command from the DOS command window: isqlw -E -SServername -ic:\temp\test.sql -oc:\temp\test.out

  3. After the DOS command window lose focus, type some characters. For example, "aaaaaaaaaaaaaaaaaaa". You will then see the following message box:
    The text in C:\temp\test.sql has been changed.
    Do you want to save the changes?


    Yes/No/No to All/Cancel
    If you click Yes, you see that the text you just typed, "aaaaaaaaaaaaaaaaaaa", is inserted into the first line of the C:\Temp\Test.sql file.

Modification Type:MajorLast Reviewed:11/6/2003
Keywords:kbBug kbfix kbSQLServ2000sp1fix KB289667