Microsoft® SQL Server® 2012 Bible

(Ben Green) #1

99


Chapter 5: SQL Server Management and Development Tools


5


You can install custom reports in any Object Explorer node by placing the report defi nition
fi le in the following directory:

...\Documents and Settings\{user}\Documents\SQL Server Management
Studio\Custom Reports

For more details see http://msdn.microsoft.com/en-us/library/
bb153684(v=SQL.110).aspx.

Using the Query Editor


With SQL Server 2005, the Query Editor carried on the legacy of SQL Server’s Query Analyzer
as the primary UI for database developers. In SQL Server 2008 and 2008R2, that experi-
enced was enhanced and evolved. Now, with SQL Server 2012 it’s an absolutely awesome
product to work with!

Opening a Query Connecting to a Server
The Query Editor can maintain multiple open query documents and connections within
the tabbed document area. Different queries may be connected as different users, which is
useful for testing security. And the Query Editor can open and work with a .sql fi le even
when not connected to a server.

When Query Editor fi rst opens, it prompts for an initial login. To make further connections,
use the File ➪ New Connection menu command.

The New Query toolbar button opens a new Query Editor document. There’s some intelli-
gence in how it selects the current database for the new query. If the Object Explorer has
focus before the New Query button is pressed, the new query connects to Object Explorer’s
currently selected database. If the Query Editor has focus, the new query opens to the same
database as the Query Editor’s current query.

You can also switch a query’s connection to another server using the Query ➪ Connection
menu, the Change Connection toolbar button, or the Query Editor’s context menu.

The query tab displays the most it can of the current SQL Server and database merged with
the fi lename.

In some extreme cases, if SQL Server appears to not accept new connections, SQL Server listens on a dedicated port
for a special diagnostic connection and tries to make a connection. A Dedicated Administrator Connection (DAC)
is only possible if you are a member of the server’s sysadmin role. To attempt a DAC connection using Query Editor,
connect to the server with a prefi x of admin: before the server name. For example, my servers’ name is Torchwood,
so connecting to it as admin:torchwood opens a DAC connection. DAC connections are also possible using the
SQLCMD utility. For more about the DAC connection, see Chapter 22.

c05 July 23, 2012 11:44 AM V1

c05.indd 99c05.indd 99 7/30/2012 4:14:49 PM7/30/2012 4:14:49 PM


http://www.it-ebooks.info
Free download pdf