This document outlines the agenda for an Advanced TSQL training course. It covers enhancing data manipulation language functionality with output clauses and merge statements, managing transactions both implicitly and explicitly, exception handling with try/catch blocks, and extending SQL Server functionality with common table expressions, XML, CLR, FileStream, spatial data, full text search, and service broker. Additional topics include apply operators, pivoting and unpivoting data, and ranking functions.
7. Merge Statement
ï‚—Provides you the ability to compare rows between source
and target tables, and then performs DML action accordingly
only on target Table.
11. Retrieving Error Information
ï‚— ERROR_NUMBER() returns the number of the error.
ï‚— ERROR_SEVERITY() returns the severity.
ï‚— ERROR_STATE() returns the error state number.
ï‚— ERROR_PROCEDURE() returns the name of the stored procedure or trigger where the error occurred.
ï‚— ERROR_LINE() returns the line number inside the routine that caused the error.
ï‚— ERROR_MESSAGE() returns the complete text of the error message. The text includes the values
supplied for any substitutable parameters, such as lengths, object names, or times.
13. CTE
ï‚— Like derived tables
ï‚— Iterates results sets
ï‚— Recursive
ï‚— CTE Parts
ï‚— With Clause
ï‚— CTE Name
ï‚— Column Names
ï‚— AS keyword
ï‚— Anchor Query
ï‚— Union All
ï‚— Second Query
ï‚— Outer Query
15. PIVOTING DATA
ï‚—Moving rows for a column as columns for aggregate
values, reversing that combination as well through
unpivot
ï‚—Parts
ï‚—Source Table
ï‚—PIVOT/UNPIVOT Operator
ï‚—Aggregation
ï‚—Filter Clause (FOR)
ï‚—Pivot Table
16. Pivot Syntax
From
(Subquery) AS Source_Table
PIVOT (
Aggregate_Function(Column_ST)
FOR Column_ST IN (Values in Column_ST)
) AS Pivot_Table