Transcription of Video: Now on to CTE’s in stored procedures, functions and views. When I first started doing this presentation several years ago, people would ask, “oh, can the CTE be used in a function or can be used in a view”? And the answer to that is yes. And as we saw above, we actually already put the CTE …

CTE’s in Stored Procedures, Functions and Views Read more »

Transcription of Video: Here’s an example of a CTE that’s been created for data paging, where the select statement inside of the CTE that shown in blue is just grabbing some table names and column names from the SIS dot columns table. And there’s a lot of them in there. And then what it’s doing is it’s calculating the row …

Steve Demonstrates Data Paging with CTE’s Read more »

Video transcription: Basically, what data Paging is, is when you’ve got a large large result set and what you want to do is display like the top 20, or top 50 results. So if you go to any search engine and do a searching on some topic, you you’ll see that you’ll get like the top 20 results out of …

Steve explains data paging with CTE’s Read more »

If you have multiple CTE’s in a query then you can do what’s called a nested CTE. This is what Steve will go over in this video. Transcription of Video: So next, if you’ve got multiple CTE’s, we can do what are considered nested CTE’s, where the previous multiples we looked at, it was just two CTE’s that were being …

Nested CTE’s in SQL Server Read more »

Added to SQL Server in 2008 Steve explains and demonstrates how to set up row constructor. Transcription of video: So there’s this thing called a row constructor. And this was added in SQL 2008. But it’s a way of saying select x from, and you give it a list of values around f of x or a function like this, …

Row Constructor in SQL Server Demo and Explanation Read more »

Improve you query skills with Common Table Expressions. The Common Table Expression (CTE) is one of the more powerful and often overlooked features in Microsoft SQL Server. This book will show some of the more interesting things you can do with a CTE. You will learn how CTEs are a great alternative to derived table queries, how to do data …

Free Copy of Steve Stedman’s CTE Book! Read more »

Let’s start slow with a simple CTE query demo for easy absorption. Transcription of video: So let’s take a look at how to write a simple CTE query. So what I have is a test database here that I’ve set up called CTE demo. And in that I’ve got a couple tables one’s called royalty that has a bunch of …

How to Write a Simple CTE Query Read more »

Check out this video explanation of how to put multiple CTE’s in a single query. Check back tomorrow for the demo on this. Transcription to this video: Now that we’ve covered how to build a CTE and how to replace some derived tables or sub queries with CTE’s, now we’re going to look at how do we put multiple common …

Multiple CTE’s in a Single Query – Explanation Read more »