You have several options for viewing and manipulating multiple code windows.
When you have two or more queries open, you can right-click the title bar of the Query Editor and choose either New Horizontal Tab Group (see the Figure below) or New Vertical Tab Group. The same options are available from the main Window menu in Management Studio.
If you select a new horizontal tab group, you’ll see something like the Figure below. Note that each window still can maintain an independent connection to an instance of SQL Server; you can see this information in the status bar at the bottom of each query editor window. Each of the tab groups you create can contain multiple query editor windows.
To move the active window to another tab group, choose Window|Move to Next Tab Group or right-click the title bar and choose Move to Next Tab Group. The option in either case might be Move to Previous Tab Group if a window in the second tab group is active. Or, you can simply drag the window to another group.
There are three ways to un-split the window:
- If the window you move is the last one in a tab group, the empty tab group will automatically close.
- Close all of the query editor windows in a tab group.
- Drag all of the query editor windows from a tab group to another tab group.
TIP: To maximize the Query Editor window, press SHIFT+ALT+ENTER. Press it again to switch back to Normal view. This keyboard shortcut works with any document window.
If you select the Window|Close All Documents option from the main menu, all documents and all tab groups will close. You’ll be prompted to save any files in windows with unsaved changes. Management Studio has your back!