R Glen Cooper

  • Interests: SQL Server, .NET, Mathematics

Navigating Trees With CTE

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 […]

4.8 (5)

2021-04-19

5,037 reads

How To Avoid MERGE in SQL Server

Introduction This article shows how to script a basic merge between two tables, without using MERGE. This can be handy when you're merging a pair of tables with hundreds of columns, since the script doesn't know anything about them. This technique introduces and populates some auditing columns (IS_DELETED, IS_INSERTED, IS_UPDATED, TRANSACTION_DATE) for each record, and runs fast. […]

4 (3)

2020-04-14

9,727 reads

Blogs

Daily Coping 17 Sep 2021

By

I started to add a daily coping tip to the SQLServerCentral newsletter and to...

Ethics in Modern Data at Music City Tech 2021

By

  On Sept 16, Christine and I presented our joint presentation on Ethics in Modern Data at...

Slides and Video from Building a Regret-free Foundation for your Data Factory Now Available

By

Last week, Kerry and I delivered a webinar with tips on how to set...

Read the latest Blogs

Forums

SQL 2016 SP3 CHECKDB WITH EXTENDED_LOGICAL_CHECKS problem.

By Ken McKelvey

This seems to be the same problem which occurred with SQL2017 CU21 and is...

Find all SPs, FNs, and VWs where particular string occurs

By Vladimir Isaev

I have this task to find all SPs, FNs, and VWs where particular string...

Excel privary levels

By V

There are three Excel privacy levels: Private, Organizational, Public. When Excel's privacy level is...

Visit the forum

Ask SSC

SQL Server Q&A from the SQLServerCentral community

Get answers