• Embed Doc
  • Readcast
  • Collections
  • CommentGo Back
Download
 
What’s in It or You:Exploring the Benefts o theSQL Server 2008 Database Engine
Author
Sharon Dooley
 
1-800-843-8733www.learningtree.ca
©2009 Learning Tree International. All Rights Reserved.
 
Introduction ...........................11. Enhancements or the Developer ......2 
1.1. The MERGE Statement ..............
2
 
1.2. Change Data Capture ...............
4
1.3. Row Constructors ..................
5
 
1.4. Beyond Relational Data .............
5
 
1.4.1. Spatial Data Types
............
5
 
1.4.2. FILESTREAM
..................
6
 
1.4.3. DATE and TIME Data Types
....
7
1.5. Additional Smaller (but Useul)Features ...........................
8
 
1.5.1. Intellisense
..................
8
 
1.5.2. Stored Procedure Debugger
...
82. Enhancements or the DBA ............8 
2.1. Policy-Based Management ..............
8
 
2.2. Auditing ..........................
10
2.3. Transparent Date Encryption .......
10
 
2.4. External Key Management .........
11
 
2.5. Availability .......................
11
 2.6. Additional Smaller (but Useul)Features ..........................
11
 
2.6.1. Hot-Add Hardware
..........
11
 
2.6.2. Backup Compression
........
11
 
2.6.3. PowerShell Integration
.......
113. Perormance Enhancements ...........12 
3.1. Management Data Warehouseand the Data Collector .............
12
 
3.2. Sparse Columns ....................
15
3.3. Filtered Indexes ...................
15
 
3.4. Resource Governor ................
16
3.5. Data Compression .................
17Summary and Reerences ................18About Learning Tree International .......19About the Author .........................19
Introduction
Flashback to late October 2005: “It” nally arrived! “It” wasthe long-awaited release o SQL Server 2005. The magnitudeo the changes made to the sotware was almost rightening,and the SQL Server community was quite vocal in demand-ing that Microsot never repeat that scenario again. Microsotlistened and promised that they would aim or a two- tothree-year interval between releases in the uture.Now it’s early 2009, and SQL Server 2008 has been availableor our months. Many members o that same SQL Servercommunity who demanded more requent releases are now complaining that it’s too soon!Is it too soon or you? Is SQL Server 2008 a “must-have” up-grade? In this paper, I’ll describe the eatures I personally ndmost compelling, ocusing on the core database engine andcovering three basic topics: Enhancements or the developer,Enhancements or the Database Administrator (DBA) andperormance Enhancements. O course, these topics overlap,so i you don’t nd what you are looking or in a particularsection, try one o the others.Many o the new eatures that I’ll describe are available only in the Enterprise Edition o SQL Server 2008. I some o theseinterest you, you’ll want to compare the eatures o the variouseditions at
http://www.microsoft.com/sqlserver/2008/en/us/editions-compare.aspx
I hope that this paper will help you decide whether or notSQL Server 2008 is a “must-have” upgrade or you.
TABLE OF CONTENTS
1
SQL Server 2008 Database Engine
LEARNING TREE INTERNATIONAL
 
White Paper
1-800-843-8733
 
www.learningtree.ca
©2009 Learning Tree International. All Rights Reserved.
 
2
1-800-843-8733
www.learningtree.ca
 
LEARNING TREE INTERNATIONAL
 
White Paper
©2009 Learning Tree International. All Rights Reserved.
SQL Server 2008 Database Engine
ProductID PurchaseDate Quantity Amount
12008050725125.002200804091013100.4532008050950750.9942008050943400.00520080608200400.00620080615300705.00
1. Enhancements or the Developer
 
1.1. The MERGE Statement
Prior to SQL Server 2008, Transact-SQL did not support an operation oten called an “Upsert,” but it was possible to workaround this lack by writing code that looked like this:
 
-- I the row is there, update it. Otherwise, insert it.
 
UPDATE mytable SET colx = valueWHERE akey = somevalueIF @@ROWCOUNT = 0BeginINSERT …End
This worked reasonably well or a single-row operation but did not handle the multirow case at all. In order to solveproblems like rereshing a data warehouse or tracking available inventory based on a day’s sales, the ANSI/ISO standardspecied a MERGE statement. In SQL Server 2008, however, Microsot has implemented this specication and hasprovided some enhancements to it as well.The MERGE statement is extremely powerul, but also quite complex. To use the MERGE statement, you need to understandtwo tables:
 
1. The Source table. The table or table-expression rom which the new and changed data comes.
 
2. The Target table. This is the table that will be modied by the data in the source table. When you are comparing two tables, there are three possible results:
 
1. There is a match between a row in the Source table and a row in the Target table based on some key.
 
2. There is a row in the Source table with no matching row in the Target table.
 
3. There is a row in the Target table with no matching row in the Source table. When you use the MERGE statement, you may need to deal with all three possibilities.
Example 1
There are two tables involved in this example. Purchases contains details o purchases by product. Purchase History containshistorical inormation about product purchases. Periodically, the contents o the Purchases table need to be placed in thePurchase History table. Now that we understand the data and the business rules, we are ready to look at the MERGE statementthat will accomplish the task.Source table (Purchases)
of 00

Leave a Comment

You must be to leave a comment.
Submit
Characters: ...
You must be to leave a comment.
Submit
Characters: ...