This month's discount Comprehensive Database Performance Health Check · Testimonials
SQLAuthority with Pinal Dave
Home
  • Consulting
    • Health Check
  • Free Videos
  • All Articles
    • AI
    • SQL Performance
    • SQL Tips and Tricks
    • Interview Questions and Answers
    • SQL Puzzle
    • SQL Video
    • SQLAuthority News
    • Personal
  • Books
  • Consulting
SQL SERVER - CTE can be Updated

SQL SERVER – CTE can be Updated

May 19, 2014
Pinal Dave
SQL Tips and Tricks
CTE, SQL Scripts, SQL View

Users often confuse a CTE with a temp table, but a CTE works like a view, and a CTE can be updated just like one. Matthew Spieth’s tip, with my notes.

Read More
Execution plan for SQL server query.

SQL SERVER – Does Use of CTE Change the Order of Join in Inner Join

March 24, 2014
Pinal Dave
SQL Tips and Tricks
CTE, Execution Plan, SQL Joins

A reader said he uses a CTE to control join order. Does a CTE change the order of join in an inner join? Here is what I found.

Read More
A hand lifts the top glass from a pyramid of stacked glasses, a red napkin at its base.

Walking Foreign Key Chains to Find a Safe Delete Order

November 3, 2012
Pinal Dave
SQL Tips and Tricks
CTE, SQL Constraint and Keys, SQL Delete, SQL Server

Map foreign key chains from a parent table with a recursive catalog query, then list deepest children first and flag cascade rules.

Read More
A whole flowering branch grafted onto a new limb of an apple tree, the joint wrapped in red tape

Building an Org Chart Query With hierarchyid

April 13, 2012
Pinal Dave
SQL Tips and Tricks
CTE, SQL Datatype, SQL Index, SQL Server

Build an org chart with hierarchyid, query descendants and levels, move a team safely, and compare it with recursive queries.

Read More
A hand lifting a bunch of grapes by its top stem, the branching stems hanging open above a red cloth

Translating Oracle CONNECT BY Queries to Recursive CTEs

February 19, 2012
Pinal Dave
SQL Tips and Tricks
CTE, Oracle, SQL Migration, SQL Server

Translate CONNECT BY into recursive CTEs with root selection, depth, paths, sibling ordering, cycle checks, and a recursion limit.

Read More
A jigsaw puzzle with pieces sorted into groups before being fitted together

Common Table Expressions for Readability

April 20, 2011
Pinal Dave
SQL Tips and Tricks
CTE, SQL Coding Standards, SQL Server, Temp Table

Common table expressions for readability name query steps and support recursion, but they do not promise cached intermediate results.

Read More
An old spinning wheel taken apart and laid out on a workshop floor in rows from largest part to smallest.

A Bill of Materials With a Recursive CTE

November 8, 2010
Pinal Dave
SQL Tips and Tricks
CTE, SQL Scripts, SQL Server

Expand a bill of materials with a recursive CTE, multiply quantities across levels, trace component paths, and guard against cycles.

Read More
Previous 1 2 3 Next
  • Books
  • Testimonials
  • Privacy Policy

© 2006 – 2026 All rights reserved. pinal @ SQLAuthority.com