December 2013
Intermediate to advanced
1872 pages
153h 31m
English
One common problem encountered with imported data is unexpected duplicate data rows, especially if the data is being consolidated from multiple sources. In previous versions of SQL Server, de-duping the data often involved the use of cursors and temp tables. Since the introduction of the ROW_NUMBER ranking function and common table expressions in SQL Server 2005, you can de-dupe data with a single statement.
To demonstrate this approach, Listing 45.38 shows how to create an authors_import table and populate it with some duplicate rows.
LISTING 45.38 Script to Create and Populate the authors_import Table
USE AdventureWorks2012GOCREATE TABLE dbo.authors_import( au_id char(11) ...