Microsoft® SQL Server® 2012 Bible

(Ben Green) #1

78


Part I: Laying the Foundations


Microsoft guidelines for applications using MARS include the following:

■ Result sets should be short-lived per SQL statement.

■ (^) If a result set is long-lived or large, then server cursors should be used.
■ Always read to the end of the results and use API/property calls to change
(^) connection properties.
By default, MARS functionality is not enabled. Turn it on by using a connection string value — MarsConn for the OLE
DB provider and Mars_Connection for the ODBC provider.
XML Data Types
Much like the current VarChar data type that persists variable character values, a new XML
data type persists XML documents and fragments. This type is available for variable declara-
tions within stored procedures, parameter declarations, and return types and conversions.
User-Defi ned Types
These types are defi ned using .NET Common Language Runtime (CLR) code. This would
include the popular C# and VB.NET languages. The data itself is exposed as fi elds and prop-
erties, with the behavior being exposed through the class methods.
Large Value Types
Three new data types have been introduced to handle values up to 2 ^ 31-1 bytes long. This
includes variables, thus allowing for text values in excess of the old 8K limit. The data
types and their corresponding old types are listed in Table 4-2.
TABLE 4 -2 SQL Server 2012 Large Values Types
Large Data Types Prior Data Types
varchar(max) Text
nvarchar(max) Ntext
varbinary(max) Image
FILESTREAM Support
FILESTREAM is a feature that was introduced in SQL Server 2008 that allows you to
store and access large binary values, either through SQL Server or by direct access to
the Windows fi le system. Large binary values are considered any values larger than 2
c04.indd 78c04.indd 78 7/30/2012 4:12:45 PM7/30/2012 4:12:45 PM
http://www.it-ebooks.info

Free download pdf