Configuring the Connection
Many of the connection-level options configure ANSI compatibility or specific connection-performance options.
Connection-level options are limited in scope. If
the option is set within an interactive session, then the setting is in
force until it's changed or the session ends. If the option is set
within a stored procedure, then the setting persists only for the life
of that stored procedure.
The connection-level options are typically configured by means of the SET command. The following code configures how SQL Server handles nulls within this current session:
SET ANSI_NULLS OFF;
Result:
Command(s) completed successfully.
Connection properties can also be checked by means of the SessionProperty() function:
Select SESSIONPROPERTY ('ANSI_NULLS');
Result:
0
Management Studio enables you to set several
query properties. You can review and set these properties for current
queries by clicking the Query menu and then Query Options. For all
future connections, review and set the properties by clicking the Tools
menu and then Options. Figure 3 shows an example of the ANSI settings that SQL Server uses to run the queries.
Tip
To view current settings of connection-level options, query the sys.dm_exec_connections dynamic management view.
4. Surface Area Configuration Facets
In SQL Server 2005 you were introduced
to the Surface Area Configuration Wizard. This simple wizard enabled
you to quickly lock down common security attack vectors in SQL Server.
When 2008 was released, that wizard was then
replaced by the functionality of Policy-Based Management. The Surface
Area Configuration Wizard's tasks were then made into facets within
Policy-Based Management. You can use these facets to create policies
that dictate the status of the various features previously controlled
by the Surface Area Configuration Wizard, as shown in Figure 4.