Learn your way! Get started

SQL 2012 Developer, Part 12 of 13: Coding Techniques

with expert Frank Tillinghast


Watch trailer


Course at a glance

Included in these subscriptions:

  • Dev & IT Pro Video
  • Dev & IT Pro Power Pack

Release date 5/27/2013
Level Advanced
Runtime 1h 19m
Closed captioning Included
Transcript Included
eBooks / courseware Included
Hands-on labs Included
Sample code Included
Exams Included


Enterprise Solutions

Need reporting, custom learning tracks, or SCORM? Learn More



Course description

As business systems become more intricate, so does the T-SQL development needed to get at that data. In this course we’ll discuss some of the challenges facing developers including complex data types and structures; the “art” of writing efficient queries; and how to tackle and simplify multi-step processes. First we’ll discuss data types, implicit and explicit conversion, and precedence. Next, we’ll move on to discuss working with multinational data and understanding collation—which are SQL Server’s rules for sorting and comparing strings. We’ll discuss working with and storing hierarchical data using the hierarchyid data type. Next you’ll learn that even little things make a difference. We’ll explore how to boost data operations by using JOINs rather than subqueries, and how to check for inclusion using EXISTS. We’ll finish up by discussing temporary tables, table variables, user-defined table-valued functions, CTEs, worktables, and user-defined table type parameters. I’ll show you how using implicit transactions can help in the debugging process and why keeping things simple usually makes the most sense.

Prerequisites

This course assumes that you have a basic familiarity with the concept of relational databases and a basic understanding of what SQL Server is and the high-level tools in it, as well as how to create and manage objects using Management Studio. You should also have a basic understanding of how SQL Server implements security, including its authentication and authorization schemes, and how to assign permissions on securable objects to principals. You should know the fundamentals of Transact-SQL to write queries to retrieve and update data, and how to execute scripts using the query editor in Management Studio. It will be very helpful, but not absolutely necessary, to have experience with .NET development using Visual Studio 2010 or 2012 for the portions of the course that deal with SQLCLR development. The .NET code included in this course is written in C#, but if you prefer Visual Basic it should be fairly easy to convert the code.

Learning Paths

This course is part of the following LearnNowOnline SuccessPaths™:
SQL Server Developer

Meet the expert

Frank Tillinghast is a senior consultant with MTOW Software Solutions. He is a Microsoft Certified Solution Developer and has been developing applications for over 15 years. Most of his time is spent consulting for companies nationwide with troubled projects or mentoring projects to successful completion. When he is not developing software or mentoring clients, Frank is teaching other developers. He has taught thousands of application developers how to create business solutions with Visual Studio .NET. VB.NET, ASP.NET, Visual C#, and SQL Server.

Course outline



Coding Techniques

Complex Data and Structures (25:49)
  • Introduction (00:27)
  • Complex Data and Structures (00:17)
  • Issues with Data Types (02:44)
  • Demo: CAST and TRY_CAST (03:56)
  • Working with Multinational Data (04:32)
  • Demo: Collation (02:13)
  • Working with Hierarchical Data (05:08)
  • Demo: Hierarchical Structure (05:57)
  • Summary (00:32)
Efficient Queries (36:35)
  • Introduction (00:43)
  • Writing More Efficient Queries (00:50)
  • The EXISTS Clause (01:14)
  • Joins vs. Subqueries (02:09)
  • One-Pass Queries (00:43)
  • Demo: One-Pass Queries (05:00)
  • Writing More Efficient Queries (00:37)
  • Using Temporary Tables (00:39)
  • Table Variables (00:50)
  • User-Defined Table-Valued (02:20)
  • Demo: UDFs (06:22)
  • Common Table Expressions (00:37)
  • Worktables (00:34)
  • User-Defined Table Type Parameters (00:48)
  • Demo: CTEs (01:55)
  • Demo: Worktables (05:31)
  • Demo: Worktables Select (04:43)
  • Summary (00:52)
Complex Queries (16:51)
  • Introduction (00:47)
  • Working with Complex Queries (00:54)
  • Using Implicit Transactions (02:57)
  • Demo: Implicit Transactions (02:55)
  • Keeping it Simple (02:11)
  • Demo: Simplifying Procedures (04:02)
  • Demo: Create a Stored Procedure (02:42)
  • Summary (00:20)