What Exactly Is a CTE in T-SQL? A Comprehensive Guide with 7 Examples
Learn how to use CTEs through the use of a number of examples.
2023-10-20
10,210 reads
Learn how to use CTEs through the use of a number of examples.
2023-10-20
10,210 reads
In this article we cover what a Common Table Expression CTE is and how to write a CTE for doing selects, inserts, deletes, updates and more.
2021-06-02
Introduction This article shows how common table expressions (CTE) in SQL Server are naturally suited for navigating trees, such as finding its longest path, or diameter. Recall that a tree is an undirected graph where unique paths exist between any two nodes (i.e. vertices). Any node may be selected as its top node, with its […]
2021-04-19
8,054 reads
A detailed description of a technique for the the solution of the Bin Packing Problem, that involves a recursive CTE and Window functions
2020-05-14 (first published: 2020-04-23)
5,682 reads
By Steve Jones
I wrote a piece on the new SUBSTRING in SQL Server 2025 and got...
By Steve Jones
If you aren’t watching the Ignite keynotes today, then you might have missed the...
Short version You want to get this running as fast as possible. Do these...
I changed my email address in Edit Profile page, but it has no effect...
Comments posted to this topic are about the item The case for "Understanding our...
Comments posted to this topic are about the item Specifying the Collation
I am dealing with issues on my SQL Server 2022 instance related to collation. I have an instance collation of Latin1_General_CS_AS_KS_WS, but a database collation of Latin1_General_CI_AS. I want to force a few queries to run with a specified collation by using code like this:
DECLARE @c VARCHAR(20) = 'Latin1_General_CI_AS'
SELECT p.PersonType,
p.Title,
p.LastName,
c.CustomerID,
c.AccountNumber
FROM Person.Person AS p
INNER JOIN Sales.Customer AS c
ON c.PersonID = p.BusinessEntityID
COLLATE @c
Will this solve my problem? See possible answers