Watch trailer
Course at a glance
Included in these subscriptions:
- Dev & IT Pro Video
- Dev & IT Pro Power Pack
Release date | 5/22/2015 | |
Level | Intermediate | |
Runtime | 1h 26m | |
Closed captioning | Included | |
Transcript | Included | |
eBooks / courseware | Included | |
Hands-on labs | Included | |
Sample code | Included | |
Exams | Included |
Course description
In this course you’ll learn how to write various kinds of code modules using C# code. You’ll learn the details of creating SQLCLR code manually as well as with Visual Studio. You’ll learn about the Sql data types and how using them can avoid data conversion issues. Most of the code you write will use basic ADO.NET for data access, but there is a special context connection you need to make to the database where the code is executing. I’ll take a close look at creating triggers and user-defined functions, then will explore the security issues of running SQLCLR code in the SQL Server process, and how to make it work. The course wraps up with some recommendations about how to decide whether to use T-SQL or SQLCLR code to create different kinds of code modules.
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 will help you prepare for the following certifications and exams:
MCSE: Business Intelligence
MCSA: SQL Server 2012/2014
MCSE: Data Platform
70-464: Developing Microsoft SQL Server 2012/2014 Databases
70-461: Querying Microsoft SQL Server 2012/2014
This course is part of the following LearnNowOnline SuccessPaths™:
SQL Server Developer
Meet the expert
Don Kiely is a featured instructor on many of our SQL Server and Visual Studio courses. He is a nationally recognized author, instructor, and consultant specializing in Microsoft technologies. Don has many years of teaching experience, is the author or co-author of several programming books, and has spoken at many industry conferences and user groups. In addition, Don is a consultant for a variety of companies that develop distributed applications for public and private organizations.
Course outline
Common Language Runtime
Introduction to SQL CLR (07:38)
- Introduction (01:04)
- Introduction to SQLCLR (01:02)
- Role of SQL Server (01:29)
- Role of CLR (01:17)
- Ways to Use SQLCLR (01:21)
- Demo: Enabling SQL CLR (01:06)
- Summary (00:17)
Writing SQL CLR Code (24:00)
- Introduction (01:16)
- Demo: Writing SQLCLR Code (04:24)
- Demo: Compiling SQLCLR Code (01:31)
- Demo: Loading SQLCLR Assembly (01:48)
- Demo: Creating a Function (02:49)
- SQLCLR Using Visual Studio (00:45)
- Demo: Database Project Template (01:14)
- Demo: Creating SQLCLR File (03:08)
- Demo: Building and Publishing (02:54)
- Demo: Solution Explorer Files (01:28)
- Demo: Server Explorer (01:34)
- Summary (01:03)
Using SQL CLR Code (21:43)
- Introduction (00:25)
- SQL Data Types (02:43)
- Data Type Mapping (01:19)
- Accessing Local Data (02:43)
- Connection String (01:42)
- Returning Results (02:39)
- Demo: Stored Procedure (00:56)
- Demo: Now Using SQLCLR Code (04:26)
- Demo: Executing SQLCLR Code (00:44)
- Demo: Realistic SQLCLR Example (03:35)
- Summary (00:26)
SQL CLR Code Modules (12:46)
- Introduction (00:26)
- Triggers (02:09)
- Demo: SQLCLR Trigger (03:58)
- Demo: Testing the Trigger (02:20)
- User-Defined Functions (01:29)
- Demo: User-Defined Function (01:46)
- Summary (00:36)
SQL CLR Security (20:09)
- Introduction (00:53)
- Demo: External Resources (03:02)
- Code Access Security (03:02)
- How Access Security Works (01:51)
- SQLCLR Permission Sets (02:39)
- Demo: Changing Permission Set (03:56)
- Demo: Executing External Code (01:15)
- T-SQL vs .NET Code (02:19)
- Deciding: SQLCLR or T-SQL? (00:53)
- Summary (00:14)