NewFeaturesinSQLServer2008•Chapter1 17
MERGE Statement
The MERGE statement performs insert, update, or delete operations on a target
table based on the results of a join to a source table.
For example, you can synchronize two tables by inserting, updating, or deleting
all of the rows in one table based on differences in the other table.
Here is an example of MERGE code:
MERGE MyDatabase.Inventory AS target
USING (SELECT ProductID, SUM(OrderQty) FROM mySales.Orders AS o
JOIN mySales.mySalesOrderHeader AS soh
ON o.mySalesOrderID = soh.mySalesOrderID
AND soh.OrderDate = @OrderDate
GROUP BY ProductID) AS source (ProductID, OrderQty)
ON (target.ProductID = source.ProductID)
WHEN MATCHED AND target.Quantity - source.OrderQty <= 0
THEN DELETE
WHEN MATCHED
THEN UPDATE SET target.Quantity = target.Quantity - source.OrderQty,
target.ModifiedDate = GETDATE()
OUTPUT $action, Inserted.ProductID, Inserted.Quantity, Inserted.ModifiedDate,
Deleted.ProductID,
Deleted.Quantity, Deleted.ModifiedDate;
More on MERGE can be found in Chapters 6 and 9.
Spatial Data Type
The spatial data type is a new data type available in SQL Server 2008. The spatial
data type is used to store location-based data. This could be a boon to applications
that do geocoding.
Analysis Services Improvements
In Analysis Services, some of the new improvements are a better cube designer,
dimension and attribute designer, and enhanced data mining structures.
ETL/SSIS Enhancements
Many of the new features carry over to SSIS, like Change Data Capture and
the MERGE statement. Another good new feature is being able to script in
18 Chapter1•NewFeaturesinSQLServer2008
C# instead of only VB.NET. This will make things a bit easier for those of
us who really like C#.
Reporting Services
There have been a few improvements to SQL Server Reporting Services.
The configuration has changed; for example, it now supports rich text format.
SharePoint integration Reporting services now will integrate closely with
Microsoft SharePoint.
No Longer Requires IIS
This is a key new breakthrough. In the past, IIS needed to be installed to host
Reporting Services. Most of the time, this involved running IIS on the database
server that had the reporting databases on it.
Better Graphing
Reporting Services supports graphing, which is great when creating dashboard style
reports, charting sales, tracking growth, or anything better suited to a graph. This
will make the Reporting Services reports an enterprise-class solution.
Export to Word Support
Reporting Services now has the ability to export to Word. This is a cool new
feature, because in the past, you needed to purchase a third-party product such as
OfficeWriter in order to export to Word.
Deprecated Features
The following is a list of deprecated features that are still available in SQL Server
2008, but will not be in future versions. Remember that while these will still work
in SQL Server 2008, they are not a recommended best practice.
BACKUP {DATABASE | LOG} WITH PASSWORD
BACKUP {DATABASE | LOG} WITH MEDIAPASSWORD
RESTORE {DATABASE | LOG} … WITH DBO_ONLY
RESTORE {DATABASE | LOG} WITH PASSWORD
RESTORE {DATABASE | LOG} WITH MEDIAPASSWORD
NewFeaturesinSQLServer2008•Chapter1 19
80 compatibility level and upgrade from version 80.
DATABASEPROPERTY
WITH APPEND clause on triggers
Default setting of disallow results from triggers option = 0
sp_dboption
FASTFIRSTROW hint
sp_addremotelogin
sp_addserver
sp_dropremotelogin
sp_helpremotelogin
sp_remoteoption
@@remserver
SET REMOTE_PROC_TRANSACTIONS
sp_dropalias
SET DISABLE_DEF_CNST_CHK
SET ROWCOUNT for INSERT, UPDATE, and DELETE
statements
Use of
*
= and =
*
COMPUTE / COMPUTE BY
sys.database_principal_aliases
sqlmaint Utility
The RAISERROR (Format: RAISERROR integer string) syntax
is deprecated.
ex a m Wa r n i n g
Be sure you are aware of deprecated and removed features, as these
may be the “correct” way to answer some of the questions that relate to
earlier versions of SQL Server. They would not be the “correct” answer
when working with SQL Server 2008.
20 Chapter1•NewFeaturesinSQLServer2008
Discontinued Features
The following is a list of features that are no longer available in SQL Server 2008:
sp_addalias
Registered Servers API
DUMP statement
LOAD statement
BACKUP LOG WITH NO_LOG
BACKUP LOG WITH TRUNCATE_ONLY
BACKUP TRANSACTION
60, 65, and 70 compatibility levels
DBCC CONCURRENCYVIOLATION
sp_addgroup
sp_changegroup
sp_dropgroup
sp_helpgroup
Northwind and pubs
Surface Area Configuration Tool
sp_makewebtask
sp_dropwebtask
sp_runwebtask
sp_enumcodepages
NewFeaturesinSQLServer2008•Chapter1 21
Summary of Exam Objectives
In this chapter, we reviewed the new features in SQL Server 2008. While most of
these features will be found on your test, it’s important to understand all of the
content in this book. You can expect that the test will cover both the new features
and some of the older features in earlier versions of SQL Server.
There are a number of deprecated features in SQL Server 2008. Know what
they are and expect them to be “wrong” answers on your test, even though they
still work in SQL Server 2008.
Be sure you know what features are no longer available in SQL Server 2008.
Know what they are and expect them to be “wrong” answers on your test.
Exam Objectives Fast Track
New Feature Overview
There are quite a few new features in SQL Server 2008, such as ˛
Change Data Capture and Declarative Management Framework.
Reporting Services no longer requires IIS. ˛
Reporting Services
Deprecated features are features that will soon be removed. To that end, ˛
you should not use any of the deprecated features, for while they will work
in SQL Server 2008, they will most likely be removed from the next
version.
Deleted features are no longer available. They may have worked with the
˛
last version of SQL Server, but they are no longer available and cannot
be used.