Microsoft KB Archive/915047

= When you try to run a query in a query editor in SQL Server Management Studio, a query in a different query editor runs instead =

Article ID: 915047

Article Last Modified on 4/6/2006

-

APPLIES TO


 * Microsoft SQL Server 2005 Standard Edition
 * Microsoft SQL Server 2005 Enterprise Edition
 * Microsoft SQL Server 2005 Developer Edition
 * Microsoft SQL Server 2005 Workgroup Edition

-





SYMPTOMS
When you try to run a query in a query editor in Microsoft SQL Server Management Studio, a query in a different query editor runs instead.

Consider the following scenario in Microsoft SQL Server 2005:
 * You open two query editors in the same instance of SQL Server Management Studio.
 * You put a query in the first query editor, and then you put a query in the second query editor.
 * You enable the Display results in a separate tab option in the first query editor.
 * You run the first query. Then, while the first query is running, you change the focus to the second query editor.
 * After the first query has finished, you try to run the second query.

In this scenario, the second query does not run. Instead, the first query runs again.



CAUSE
This problem occurs because the focus returns to the first query editor when the first query has finished. If the Display results in a separate tab check box is selected in the first query editor, the Results tab in the first query editor is automatically enabled when the first query is finished. Therefore, the focus automatically returns to the first query editor, even though you have selected the second query editor.



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

913089 How to obtain the latest service pack for SQL Server 2005



WORKAROUND
To work around this problem, use one of the following methods:
 * After the first query has finished, click the tab of the second query editor to change the focus to the second query. Then run the query in the second query editor.
 * Before you run the query in the first query editor, clear the Display results in a separate tab check box in the Query Options window. (For more information about how to do this, see the &quot;MoreInformation&quot; section.) Run the query in the first query editor. Then run the query in the second query editor.



STATUS
Microsoft has confirmed that this is a problem in the Microsoft products that are listed in the &quot;Applies to&quot; section. This problem was first corrected in Microsoft SQL Server 2005 Service Pack 1.



Steps to reproduce the problem

 * 1) Open two query editors in the same instance of SQL Server Management Studio.
 * 2) Put a query in the first query editor, and then put a query in the second query editor.
 * 3) In the first query editor, click the Query menu, and then click Query Options.
 * 4) Click Result in the left pane.
 * 5) Click Display results in a separate tab, and then click OK.
 * 6) Run the query in the first query editor. While the query is running, click the tab of the second query editor to bring it to the front.
 * 7) After the query in the first query editor runs, run the query in the second query editor.

When you do this, the second query does not run. Instead, the first query runs again.

Keywords: kbtshoot kbqfe kbprb kbexpertiseadvanced kbsql2005tool kbsql2005repl kbsql2005sp1fix KB915047

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.